I took a look at some of the scripts in AC and saw that there where some float comparisons using == or != operator. So then I ran a Code Inspection in Rider and it found about 120 cases where floats are compared using an equal operator. I have been taught that this is not a good code practice since it can cause false negatives, because floats are slightly imprecise. Shouldn't you use Mathf.Approximatly method or something similar like Math.abs( a - b) < float.Epsilon. Or am I missing something? Does the C# compiler fix this automatically?
Comments
Thank you for pointing this out. While in most cases this is actually fine (due to only being related to Editors etc), it is indeed best practice to use approximations. I shall remedy this in the next release.