Source context

Program Rust

Dec2flt_modelNumImpTraitsFloatExtU32

This Rust is the input prepared for Aeneas. Modeling choices explains the adaptations from the production source.

268     }269 }270 271 impl FloatExt for f32 {272     #[inline]273     fn from_u64_bits(v: u64) -> Self {274         f32::from_bits((v & 0xFFFFFFFF) as u32)275     }276 277     // This is the upstream default after substituting `Self::Int = u32`;278     // concreteness is needed only because Charon cannot resolve the generic279     // associated-integer shifts and bit operators for Aeneas.280     fn integer_decode(self) -> (u64, i16, i8) {281         let bits = self.to_bits();282         let sign = if bits >> 31 == 0 { 1 } else { -1 };283         let mut exponent = ((bits & Self::EXPONENT_MASK) >> 23) as i16;284         let mantissa = if exponent == 0 {285             (bits & Self::MANTISSA_MASK) << 1286         } else {287             (bits & Self::MANTISSA_MASK) | (1_u32 << 23)288         };289         exponent -= 127 + 23;290         (mantissa as u64, exponent, sign)291     }292 }293 294 impl Float for f64 {295     type Int = u64;

Aeneas declaration

The Lean below was mechanically extracted by Aeneas from Rust.

@[reducible]
def F32.Insts.Dec2flt_modelNumImpTraitsFloatExtU32 : num.imp.traits.FloatExt
  F32 Std.U32 := {
  FloatInst := F32.Insts.Dec2flt_modelNumImpTraitsFloatU32
  from_u64_bits := F32.Insts.Dec2flt_modelNumImpTraitsFloatExtU32.from_u64_bits
  integer_decode :=
    F32.Insts.Dec2flt_modelNumImpTraitsFloatExtU32.integer_decode
}
Operations used here

FloatExt · Program Rust

integer_decode · Program Rust

from_u64_bits · Program Rust

Dec2flt_modelNumImpTraitsFloatU32 · Program Rust

Source details
DeclarationF32.Insts.Dec2flt_modelNumImpTraitsFloatExtU32
Filenum/imp/../../traits.rs
Lines271:0–292:1
Program versionPreparation 1