Program Rust
is_8digits
This Rust is the input prepared for Aeneas. Modeling choices explains the adaptations from the production source.
41 /// digits.42 ///43 /// This does not care about the order in which the bytes were loaded.44 pub(crate) fn is_8digits(v: u64) -> bool {45 let a = v.wrapping_add(0x4646_4646_4646_4646);46 let b = v.wrapping_sub(0x3030_3030_3030_3030);47 (a | b) & 0x8080_8080_8080_8080 == 048 }49 50 /// A custom 64-bit floating point type, representing `m * 2^p`.51 /// p is biased, so it be directly shifted into the exponent bits.Aeneas declaration
The Lean below was mechanically extracted by Aeneas from Rust.
def num.imp.dec2flt.common.is_8digits (v : Std.U64) : Result Bool := do
let a ← lift (core.num.U64.wrapping_add v 5063812098665367110#u64)
let b ← lift (core.num.U64.wrapping_sub v 3472328296227680304#u64)
let i ← lift (a ||| b)
let i1 ← lift (i &&& 9259542123273814144#u64)
ok (i1 = 0#u64)Source details
| Declaration | num.imp.dec2flt.common.is_8digits |
|---|---|
| File | num/imp/../../dec2flt/common.rs |
| Lines | 44:0–48:1 |
| Program version | Revised program |