1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#[cfg(test)] pub mod tests; pub trait FloatExt { const MAX_SAFE_INT: u64; } macro_rules! imp { ($ty:ty) => { impl FloatExt for $ty { const MAX_SAFE_INT: u64 = 1 << <$ty>::MANTISSA_DIGITS; } }; } imp!(f32); imp!(f64);