Expand description
§Floating Point Comparison
This crate provides a custom floating-point number representation (Float
) that
separates a floating-point number into its core components: mantissa, exponent, and sign.
The primary purpose is to enable precise floating-point comparisons and benchmarking
against other floating-point comparison methods.
§Features
- Custom floating-point representation using mantissa, exponent, and sign
- Conversion to and from f64
- Precise comparison operations
- Benchmarking infrastructure for comparison with other methods (e.g., Decimal)
§Example
use fast_float_compare::Float;
let a = Float::from_f64(1.23);
let b = Float::from_f64(4.56);
assert!(a < b);
// Roundtrip conversion
let value = 1.23;
let raw = Float::from_f64(value).unwrap();
let converted = raw.to_f64();
assert!((value - converted).abs() < 1e-10);
Structs§
- Float
- A custom floating-point number representation that separates the number into its fundamental components for more precise comparison operations.