Source context

Program Rust

Dec2flt_modelNumImpDec2fltLemireU64

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

214     }215 }216 217 impl Lemire for f64 {218     // Exact upstream formula results for `SIG_TOTAL_BITS = 53`.219     const MAX_EXPONENT_FAST_PATH: i64 = 22;220     const MAX_EXPONENT_DISGUISED_FAST_PATH: i64 = 37;221 222     fn pow10_fast_path(exponent: usize) -> Self {223         // These bit patterns are exactly the source table's rounded binary64224         // literals.  The match is the same masked lookup; it merely keeps float225         // constants out of Aeneas's unsupported constant interpreter.226         match exponent & 31 {227             0 => f64::from_bits(0x3FF0_0000_0000_0000),228             1 => f64::from_bits(0x4024_0000_0000_0000),229             2 => f64::from_bits(0x4059_0000_0000_0000),230             3 => f64::from_bits(0x408F_4000_0000_0000),231             4 => f64::from_bits(0x40C3_8800_0000_0000),232             5 => f64::from_bits(0x40F8_6A00_0000_0000),233             6 => f64::from_bits(0x412E_8480_0000_0000),234             7 => f64::from_bits(0x4163_12D0_0000_0000),235             8 => f64::from_bits(0x4197_D784_0000_0000),236             9 => f64::from_bits(0x41CD_CD65_0000_0000),237             10 => f64::from_bits(0x4202_A05F_2000_0000),238             11 => f64::from_bits(0x4237_4876_E800_0000),239             12 => f64::from_bits(0x426D_1A94_A200_0000),240             13 => f64::from_bits(0x42A2_309C_E540_0000),241             14 => f64::from_bits(0x42D6_BCC4_1E90_0000),242             15 => f64::from_bits(0x430C_6BF5_2634_0000),243             16 => f64::from_bits(0x4341_C379_37E0_8000),244             17 => f64::from_bits(0x4376_3457_85D8_A000),245             18 => f64::from_bits(0x43AB_C16D_674E_C800),246             19 => f64::from_bits(0x43E1_58E4_6091_3D00),247             20 => f64::from_bits(0x4415_AF1D_78B5_8C40),248             21 => f64::from_bits(0x444B_1AE4_D6E2_EF50),249             22 => f64::from_bits(0x4480_F0CF_064D_D592),250             _ => f64::from_bits(0),251         }252     }253 254     #[inline]255     // Aeneas cannot translate the source `u64 as f64` primitive conversion, so256     // `charon::opaque` makes this entire asserted conversion external: both the257     // unchanged `debug_assert!` and the unchanged cast below are in the opaque258     // body. The callers, their fast-path guards, and their surrounding259     // computation remain mechanically visible. A corresponding model binding260     // must fail the assertion above `MAX_MANTISSA_FAST_PATH` and return the261     // exact binary64 conversion at or below that bound.262     #[charon::opaque]263     fn from_u64(v: u64) -> Self {264         debug_assert!(v <= Self::MAX_MANTISSA_FAST_PATH);265         v as _266     }267 }268 269 #[inline]270 pub(super) fn pfe_empty() -> ParseFloatError {

Aeneas declaration

The Lean below was mechanically extracted by Aeneas from Rust.

@[reducible]
impl_def F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64 : num.imp.dec2flt.Lemire
  F64 Std.U64 := {
  MAX_EXPONENT_FAST_PATH := ok
    F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64.MAX_EXPONENT_FAST_PATH
  MIN_EXPONENT_FAST_PATH :=
    num.imp.dec2flt.Lemire.MIN_EXPONENT_FAST_PATH.default
    F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64
  MAX_EXPONENT_DISGUISED_FAST_PATH := ok
    F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64.MAX_EXPONENT_DISGUISED_FAST_PATH
  MAX_MANTISSA_FAST_PATH :=
    num.imp.dec2flt.Lemire.MAX_MANTISSA_FAST_PATH.default
    F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64
  traitsFloatExtInst := F64.Insts.Dec2flt_modelNumImpTraitsFloatExtU64
  pow10_fast_path :=
    F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64.pow10_fast_path
  from_u64 := F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64.from_u64
}
Operations used here

Lemire · Program Rust

default · Program Rust

default · Program Rust

Dec2flt_modelNumImpTraitsFloatExtU64 · Program Rust

from_u64 · Program Rust

pow10_fast_path · Program Rust

MAX_EXPONENT_DISGUISED_FAST_PATH · Program Rust

MAX_EXPONENT_FAST_PATH · Program Rust

Source details
DeclarationF64.Insts.Dec2flt_modelNumImpDec2fltLemireU64
Filenum/imp/../../dec2flt/mod.rs
Lines217:0–267:1
Program versionRevised program