-1.#IND

This forum is currently in read-only mode.
  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • -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".

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)