Source context

Program Rust

pow10_fast_path

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

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, so

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
Lines222:4–252:5
Program versionOriginal program