Trait float_eq::FloatEqDebugUlpsDiff
source · [−]pub trait FloatEqDebugUlpsDiff {
type DebugUlpsDiff;
}Expand description
Per-field results of ULPs based diff calculations.
This trait establishes a one-to-one relation between an IEEE floating point
type and a type whose fields are expected to be structurally identical but
specified as the result of calculating a diff in ULPs. This is usually
UlpsTol wrapped in an Option, since the ULPs diff between two floats is
a partial function that returns None when the signs differ. It is used by
testing and debugging tools to show the difference between two values on a
per-field basis and is built for clarity, not runtime efficiency.
By convention, this type is named FooDebugUlpsDiff for a given type Foo.
The DebugUlpsDiff type alias exists to simplify usage, for example
DebugUlpsDiff<f32> is Option<u32>.
To implement this trait over a new type, see How to compare custom types.
Required Associated Types
type DebugUlpsDiff
type DebugUlpsDiff
A structurally identical type to Self, with fields recursively wrapped
by DebugUlpsDiff.