Source context

Program Rust

pow10_fast_path

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

211     const MAX_EXPONENT_FAST_PATH: i64 = 22;212     const MAX_EXPONENT_DISGUISED_FAST_PATH: i64 = 37;213 214     fn pow10_fast_path(exponent: usize) -> Self {215         // These bit patterns are exactly the source table's rounded binary64216         // literals.  The match is the same masked lookup; it merely keeps float217         // constants out of Aeneas's unsupported constant interpreter.218         match exponent & 31 {219             0 => f64::from_bits(0x3FF0_0000_0000_0000),220             1 => f64::from_bits(0x4024_0000_0000_0000),221             2 => f64::from_bits(0x4059_0000_0000_0000),222             3 => f64::from_bits(0x408F_4000_0000_0000),223             4 => f64::from_bits(0x40C3_8800_0000_0000),224             5 => f64::from_bits(0x40F8_6A00_0000_0000),225             6 => f64::from_bits(0x412E_8480_0000_0000),226             7 => f64::from_bits(0x4163_12D0_0000_0000),227             8 => f64::from_bits(0x4197_D784_0000_0000),228             9 => f64::from_bits(0x41CD_CD65_0000_0000),229             10 => f64::from_bits(0x4202_A05F_2000_0000),230             11 => f64::from_bits(0x4237_4876_E800_0000),231             12 => f64::from_bits(0x426D_1A94_A200_0000),232             13 => f64::from_bits(0x42A2_309C_E540_0000),233             14 => f64::from_bits(0x42D6_BCC4_1E90_0000),234             15 => f64::from_bits(0x430C_6BF5_2634_0000),235             16 => f64::from_bits(0x4341_C379_37E0_8000),236             17 => f64::from_bits(0x4376_3457_85D8_A000),237             18 => f64::from_bits(0x43AB_C16D_674E_C800),238             19 => f64::from_bits(0x43E1_58E4_6091_3D00),239             20 => f64::from_bits(0x4415_AF1D_78B5_8C40),240             21 => f64::from_bits(0x444B_1AE4_D6E2_EF50),241             22 => f64::from_bits(0x4480_F0CF_064D_D592),242             _ => f64::from_bits(0),243         }244     }245 246     #[inline]247     // This method is precisely the source `u64 as f64` primitive conversion.

Aeneas declaration

The Lean below was mechanically extracted by Aeneas from Rust.

def F64.Insts.Dec2flt_modelNumImpDec2fltLemireU64.pow10_fast_path
  (exponent : Std.Usize) : Result F64 := do
  let i ← lift (exponent &&& 31#usize)
  match i.val with
  | 0 => core.f64.F64.from_bits 4607182418800017408#u64
  | 1 => core.f64.F64.from_bits 4621819117588971520#u64
  | 2 => core.f64.F64.from_bits 4636737291354636288#u64
  | 3 => core.f64.F64.from_bits 4652007308841189376#u64
  | 4 => core.f64.F64.from_bits 4666723172467343360#u64
  | 5 => core.f64.F64.from_bits 4681608360884174848#u64
  | 6 => core.f64.F64.from_bits 4696837146684686336#u64
  | 7 => core.f64.F64.from_bits 4711630319722168320#u64
  | 8 => core.f64.F64.from_bits 4726483295884279808#u64
  | 9 => core.f64.F64.from_bits 4741671816366391296#u64
  | 10 => core.f64.F64.from_bits 4756540486875873280#u64
  | 11 => core.f64.F64.from_bits 4771362005757984768#u64
  | 12 => core.f64.F64.from_bits 4786511204640096256#u64
  | 13 => core.f64.F64.from_bits 4801453603149578240#u64
  | 14 => core.f64.F64.from_bits 4816244402031689728#u64
  | 15 => core.f64.F64.from_bits 4831355200913801216#u64
  | 16 => core.f64.F64.from_bits 4846369599423283200#u64
  | 17 => core.f64.F64.from_bits 4861130398305394688#u64
  | 18 => core.f64.F64.from_bits 4876203697187506176#u64
  | 19 => core.f64.F64.from_bits 4891288408196988160#u64
  | 20 => core.f64.F64.from_bits 4906019910204099648#u64
  | 21 => core.f64.F64.from_bits 4921056587992461136#u64
  | 22 => core.f64.F64.from_bits 4936209963552724370#u64
  | _ => core.f64.F64.from_bits 0#u64
Operations used here

from_bits · Rust library

Source details
DeclarationF64.Insts.Dec2flt_modelNumImpDec2fltLemireU64.pow10_fast_path
Filenum/imp/../../dec2flt/mod.rs
Lines214:4–244:5
Program versionPreparation 1