approximately(<-val1 <-val2)
Compares two floating point values and returns true if they are similar.
Floating point imprecision makes comparing floats using the equals operator inaccurate. For example, (1.0 == 10.0 / 10.0) might not return true every time. Approximately() compares two floats and returns true if they are within a small value (Epsilon1)) of each other.
See Mathf.Approximately in Unity3D documentation
If you came to this documentation for an API to handle an approximation that's much larger than (Epsilon2)), such as comparing 1.625002 to 1.625000, an alternative is to use Distance and define your own approximation margin.
if (approximately(1.000001 1)) trace("1.000001 is approximately equal to 1") endif
⇐ Index