1.#INF was easy enough to figure out, but I'm trying to do some distance calculations and I occasionally see the value "1.#J" printed. What in the world is this?

1.#INF was easy enough to figure out, but I'm trying to do some distance calculations and I occasionally see the value "1.#J" printed. What in the world is this?

well, if #INF is infinity, then #J might be an imaginary number, as in electrical engineering j is often used instead of i in formulas to prevent confusion with other standard letters like "I" for current.
If you have square roots in your formula, then you can have an imaginary number, as i/j is sqrt(-1).

edit: since you just wrote that post above:
x/sqrt(0) might not equal x/0 in lua, since you are doing calculations using floats, so you can easily reach a negative number though it might not look like it at first (a negative number veeeeeery close to zero could still be displayed as a true zero in debug output) and the square root of a negative number always results in imaginary numbers.

If you want to prevent that, you could do something like x/sqrt(abs(...)), that should ensure you have a positive number

1.#IND is math.sqrt(-x) (at least on the stand-alone Lua parser for Windows).
1.#IND is also any number that is out of range (for my tests, I used 2^10000).
1.#INF is x/0

1.#IND is math.sqrt(-x) (at least on the stand-alone Lua parser for Windows).
1.#IND is also any number that is out of range (for my tests, I used 2^10000).
1.#INF is x/0

2^222222222222222222222222 printed 1.#INF not 1.#IND in my lua shell?

*shrug* The cases where that calculation would be made are all invalid cases that can be prevented, but I'd still like to know exactly what 1.#J means. I can't seem to turn it up by any calculation I've thought of to enter manually. This, by the way, is the line that's turning up that value. Just using print to output:

*shrug* The cases where that calculation would be made are all invalid cases that can be prevented, but I'd still like to know exactly what 1.#J means. I can't seem to turn it up by any calculation I've thought of to enter manually. This, by the way, is the line that's turning up that value. Just using print to output:

since it's a quirk of formatting, it'll probably show up differently in different lua compiles and different implementations of printing/formatting methods. that is, wow might do things differently than a standalone lua shell/interpreter.

1.#IND is math.sqrt(-x) (at least on the stand-alone Lua parser for Windows).
1.#IND is also any number that is out of range (for my tests, I used 2^10000).
1.#INF is x/0

Odd, I get different returns on Linux.

Both 2^10000 and 1/0 return 'inf'. math.sqrt(-1) returns 'nan'.

since it's a quirk of formatting, it'll probably show up differently in different lua compiles and different implementations of printing/formatting methods. that is, wow might do things differently than a standalone lua shell/interpreter.

well, if #INF is infinity, then #J might be an imaginary number, as in electrical engineering j is often used instead of i in formulas to prevent confusion with other standard letters like "I" for current.

If you have square roots in your formula, then you can have an imaginary number, as i/j is sqrt(-1).

edit: since you just wrote that post above:x/sqrt(0) might not equal x/0 in lua, since you are doing calculations using floats, so you can easily reach a negative number though it might not look like it at first (a negative number veeeeeery close to zero could still be displayed as a true zero in debug output) and the square root of a negative number always results in imaginary numbers.

If you want to prevent that, you could do something like x/sqrt(abs(...)), that should ensure you have a positive number

my understanding is that 1.#J comes from trying to format a NaN/infinity. are you using a formatted print statement?

1.#IND is also any number that is out of range (for my tests, I used 2^10000).

1.#INF is x/0

2^222222222222222222222222 printed 1.#INF not 1.#IND in my lua shell?

But that still wouldn't explain the 1.#J :)

But what are the values of self.[xy][12] (regex -- yes, I'm a geek) at the time?

since it's a quirk of formatting, it'll probably show up differently in different lua compiles and different implementations of printing/formatting methods. that is, wow might do things differently than a standalone lua shell/interpreter.

Odd, I get different returns on Linux.

Both 2^10000 and 1/0 return 'inf'. math.sqrt(-1) returns 'nan'.

ok, that's truly irritating.

It's a function of the C/math library, not Lua.