For questions about using Classic.

Post » Thu Oct 13, 2011 8:15 pm

What do these float errors mean, and how do you stop them? Are they caused by floats exceeding a certain precision, or are they returned by math functions? It happens with anglediff(), specifically.

Edit: searched the forums and found that it's caused by illegal math operations like div 0 etc. Also found a bugfix in 0.99 which fixed a problem with anglediff() sometimes returning -1.#IND with 2 identical parameters due to a float rounding error. This sounds exactly like my bug, since i'm using long floats with anglediff every frame, with a high possibility of identical angles. I'm geussing the bug is actually still there.

Using Classic r1.2

Also, can you check for -1.#IND in expressions/conditions as a string? I'm guessing no, but it could be useful.Davioware2011-10-13 20:33:06
Posts: 1,224
Reputation: 8,480

Post » Thu Oct 13, 2011 10:15 pm

-1.#IND means undefined.
You can get that result with an expression like sqrt(-1) or acos(-2).

Anglediff uses a vector dot product to do it's calculation, which is then converted back into an angle with acos. Acos only works with a value in the range of -1 to 1. Some rounding occurs that sometimes pushes the value just beyond that range resulting in a value of undefined.

It only occurs in two situations, when the anglediff is 0 (which is fixed) and when the anglediff is 180. So if the resulting value is -1.#IND the angle diff is 180.

I will fix it when I get on my dev pc. In the mean time you can check to see if a number is undefined by converting it to a string and comparing it with "-1.#IND".R0J0hound2011-10-13 22:16:16
Posts: 5,556
Reputation: 85,325

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 2 guests