Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llVecMag returns negative values?

Jack Abraham
Lantern By Day
Join date: 11 Apr 2008
Posts: 113
10-22-2009 07:19
I'm trying to run down an elusive math error and the only thing I have found so far is a place where the result of llVecMag is being raised to a fractional power. Am I not correct that the result of llVecMag will always be 0.0 or greater?
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
10-22-2009 07:26
/me quotes...
From: da wiki
Returns a float that is the magnitude of the vector (the undirected nonnegative distance from vec to <0.0, 0.0, 0.0>;). It can be evaluated by doing llSqrt(vec.x*vec.x + vec.y*vec.y + vec.z*vec.z).

I don't see how this could ever result in a value less than 0.. Then again, it's been more than a few years since I've had to think about actual math stuff.

edit: any chance that the vector you're feeding llVecMag has a really, really big component to it?

edit edit: d'oh.. the quote even says non-negative..
_____________________
Tired of shouting clubs and lucky chairs? Vote for llParcelSay!!!
- Go here: http://jira.secondlife.com/browse/SVC-1224
- If you see "if you were logged in.." on the left, click it and log in
- Click the "Vote for it" link on the left
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
10-22-2009 07:27
I believe that llVecMag(v) = llSqrt(v.x*v.x + v.y*v.y + v.z*v.z), in which case it has to be non-negative.
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask.... ;)

Look for my work in XStreetSL at
Jack Abraham
Lantern By Day
Join date: 11 Apr 2008
Posts: 113
10-22-2009 12:35
OK. Just checking... this is getting pretty frustrating. Plus, I can't reproduce it, but users keep reporting it...