Game dev
Saved & recent

Epsilon

Related terms: floating-point precision, tolerance, approximate equality

A small tolerance used to decide whether two approximate values are close enough. For example, an arrival test can accept a distance below 0.01 meters instead of waiting for exactly zero.

Choose the tolerance for the units and scale of the problem. Large values may need a relative tolerance too. Machine epsilon describes a numeric type near 1; it is not automatically the right gameplay tolerance.

abs(a - b) <= max(absTol, relTol * max(abs(a), abs(b)))

Further reading
tolerance 0.01 0.98 0.99 1.00 1.01 1.02 1.006 inside 1.018 outside target 1.00
Around 1.00, an absolute tolerance of 0.01 accepts the interval from 0.99 to 1.01, including its endpoints.

View in the full Game dev collection