Program Rust
FloatExt
This Rust is the input prepared for Aeneas. Modeling choices explains the adaptations from the production source.
167 /// Items that ideally would be on `Float`, but don't apply to all float types because they168 /// rely on the mantissa fitting into a `u64` (which isn't true for `f128`).169 #[doc(hidden)]170 pub trait FloatExt: Float {171 /// Performs a raw transmutation from an integer.172 fn from_u64_bits(v: u64) -> Self;173 174 /// Returns the mantissa, exponent and sign as integers.175 ///176 /// This returns `(m, p, s)` such that `s * m * 2^p` represents the original float. For 0, the177 /// exponent will be `-(EXP_BIAS + SIG_BITS)`, which is the minimum subnormal power. For178 /// infinity or NaN, the exponent will be `EXP_SAT - EXP_BIAS - SIG_BITS`.179 ///180 /// If subnormal, the mantissa will be shifted one bit to the left. Otherwise, it is returned181 /// with the explicit bit set but otherwise unshifted182 ///183 /// `s` is only ever +/-1.184 fn integer_decode(self) -> (u64, i16, i8);185 }186 187 #[cfg(target_has_reliable_f16)]188 // The f16 implementation is outside the exclusively f64 scope. Disabling itAeneas declaration
The Lean below was mechanically extracted by Aeneas from Rust.
structure num.imp.traits.FloatExt (Self : Type) (Self_Clause0_Int : Type) where
FloatInst : num.imp.traits.Float Self Self_Clause0_Int
from_u64_bits : Std.U64 → Result Self
integer_decode : Self → Result (Std.U64 × Std.I16 × Std.I8)Operations used here
Source details
| Declaration | num.imp.traits.FloatExt |
|---|---|
| File | num/imp/../../traits.rs |
| Lines | 170:0–185:1 |
| Program version | Preparation 2 |