[−][src]Constant gramit::fp::EQ_THRESHOLD_F32
pub const EQ_THRESHOLD_F32: f32
The default threshold for approximate equality for f32
s.
This value is based on (but larger than) the host system's machine epsilon for 32-bit floating point numbers.
The machine epsilon is an upper bound on the relative rounding error incurred by a single
arithmetic operation. In contrast, EQ_THRESHOLD_F32
is intended to provide an upper bound on
the absolute error incurred by a moderate-length series of operations, and so is several
times the machine epsilon.
For very long, iterative, or recursive calculations, or calculations that involve very large
numbers, this bound may be too tight. For such cases, ApproxEq
provides the
within_threshold
method to allow users to provide a more appropriate bound.
See the ApproxEq
trait for further information.