Program Rust
Dec2flt_modelNumImpTraitsFloatExtU64
This Rust is the input prepared for Aeneas. Modeling choices explains the adaptations from the production source.
321 }322 }323 324 impl FloatExt for f64 {325 #[inline]326 fn from_u64_bits(v: u64) -> Self {327 f64::from_bits(v)328 }329 330 // This is the upstream default after substituting `Self::Int = u64`;331 // it preserves every decoded field while avoiding unsupported generic332 // associated-integer operator resolution.333 fn integer_decode(self) -> (u64, i16, i8) {334 let bits = self.to_bits();335 let sign = if bits >> 63 == 0 { 1 } else { -1 };336 let mut exponent = ((bits & Self::EXPONENT_MASK) >> 52) as i16;337 let mantissa = if exponent == 0 {338 (bits & Self::MANTISSA_MASK) << 1339 } else {340 (bits & Self::MANTISSA_MASK) | (1_u64 << 52)341 };342 exponent -= 1023 + 52;343 (mantissa, exponent, sign)344 }345 }Aeneas declaration
The Lean below was mechanically extracted by Aeneas from Rust.
@[reducible]
def F64.Insts.Dec2flt_modelNumImpTraitsFloatExtU64 : num.imp.traits.FloatExt
F64 Std.U64 := {
FloatInst := F64.Insts.Dec2flt_modelNumImpTraitsFloatU64
from_u64_bits := F64.Insts.Dec2flt_modelNumImpTraitsFloatExtU64.from_u64_bits
integer_decode :=
F64.Insts.Dec2flt_modelNumImpTraitsFloatExtU64.integer_decode
}Operations used here
Source details
| Declaration | F64.Insts.Dec2flt_modelNumImpTraitsFloatExtU64 |
|---|---|
| File | num/imp/../../traits.rs |
| Lines | 324:0–345:1 |
| Program version | Preparation 1 |