Program Rust
Dec2flt_modelNumImpTraitsFloatExtU64
This Rust is the input prepared for Aeneas. Modeling choices explains the adaptations from the production source.
336 }337 }338 339 impl FloatExt for f64 {340 #[inline]341 fn from_u64_bits(v: u64) -> Self {342 f64::from_bits(v)343 }344 345 // This is the upstream default after substituting `Self::Int = u64`;346 // it preserves every decoded field while avoiding unsupported generic347 // associated-integer operator resolution.348 fn integer_decode(self) -> (u64, i16, i8) {349 let bits = self.to_bits();350 let sign = if bits >> 63 == 0 { 1 } else { -1 };351 let mut exponent = ((bits & Self::EXPONENT_MASK) >> 52) as i16;352 let mantissa = if exponent == 0 {353 (bits & Self::MANTISSA_MASK) << 1354 } else {355 (bits & Self::MANTISSA_MASK) | (1_u64 << 52)356 };357 exponent -= 1023 + 52;358 (mantissa, exponent, sign)359 }360 }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 | 339:0–360:1 |
| Program version | Original program |