Source context

Program Rust

full_multiplication

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

123 }124 125 #[inline]126 fn full_multiplication(a: u64, b: u64) -> (u64, u64) {127     let r = (a as u128) * (b as u128);128     (r as u64, (r >> 64) as u64)129 }130 131 // This will compute or rather approximate w * 5**q and return a pair of 64-bit words132 // approximating the result, with the "high" part corresponding to the most significant

Aeneas declaration

The Lean below was mechanically extracted by Aeneas from Rust.

def num.imp.dec2flt.lemire.full_multiplication
  (a : Std.U64) (b : Std.U64) : Result (Std.U64 × Std.U64) := do
  let i ← lift (UScalar.cast .U128 a)
  let i1 ← lift (UScalar.cast .U128 b)
  let r ← i * i1
  let i2 ← lift (UScalar.cast .U64 r)
  let i3 ← r >>> 64#i32
  let i4 ← lift (UScalar.cast .U64 i3)
  ok (i2, i4)
Source details
Declarationnum.imp.dec2flt.lemire.full_multiplication
Filenum/imp/../../dec2flt/lemire.rs
Lines126:0–129:1
Program versionRevised program