You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Replace BigRational::from_float(x) with a manual mantissa/exponent decomposition that avoids GCD normalization, giving faster construction with identical exactness.
Current State
f64_to_bigrational (src/exact.rs:74) uses BigRational::from_float(x), which internally:
Converts f64 to a rational
Normalizes the rational (computes GCD of numerator and denominator, divides both)
The GCD reduction is unnecessary here because we can construct the exact rational directly from the IEEE 754 representation.
Proposed Changes
Implement a custom conversion that decomposes f64 into its IEEE 754 components:
Summary
Replace
BigRational::from_float(x)with a manual mantissa/exponent decomposition that avoids GCD normalization, giving faster construction with identical exactness.Current State
f64_to_bigrational(src/exact.rs:74) usesBigRational::from_float(x), which internally:The GCD reduction is unnecessary here because we can construct the exact rational directly from the IEEE 754 representation.
Proposed Changes
Implement a custom conversion that decomposes f64 into its IEEE 754 components:
Benefits
m × 2^e)Implementation Notes
BigRational::new_rawexists innum-rational(it does — creates ratio without normalization)