Why not using ==?

I don’t understand the logic here ? I mean if a number is “not quite 0” then it’s a divisible number so we won’t have the error NaN.

I understand that for most float it’s unreliable to do a == comparison, but here shouldn’t the rules of math protect us ?

1 Like

The rules of math is not the problem, the problem is that the floats while super close to each other may not be equal. It is more a computer problem and not a math problem.

You can see the errors @Bryant_Schaper is talking about in the inspector; When you set a transform’s positions, scale, or rotation to 0, the inspector might display some weird, long number, that’s why you should never compare floats.

2 Likes

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms