Source context

Program Rust

FloatExt

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

165 /// Items that ideally would be on `Float`, but don't apply to all float types because they166 /// rely on the mantissa fitting into a `u64` (which isn't true for `f128`).167 #[doc(hidden)]168 pub trait FloatExt: Float {169     /// Performs a raw transmutation from an integer.170     fn from_u64_bits(v: u64) -> Self;171 172     /// Returns the mantissa, exponent and sign as integers.173     ///174     /// This returns `(m, p, s)` such that `s * m * 2^p` represents the original float. For 0, the175     /// exponent will be `-(EXP_BIAS + SIG_BITS)`, which is the minimum subnormal power. For176     /// infinity or NaN, the exponent will be `EXP_SAT - EXP_BIAS - SIG_BITS`.177     ///178     /// If subnormal, the mantissa will be shifted one bit to the left. Otherwise, it is returned179     /// with the explicit bit set but otherwise unshifted180     ///181     /// `s` is only ever +/-1.182     fn integer_decode(self) -> (u64, i16, i8);183 }184 185 #[cfg(target_has_reliable_f16)]186 impl Float for f16 {

Aeneas 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

Float · Program Rust

Source details
Declarationnum.imp.traits.FloatExt
Filenum/imp/../../traits.rs
Lines168:0–183:1
Program versionPreparation 1