Program Rust
parse_long_mantissa_loop2
This Rust is the input prepared for Aeneas. Modeling choices explains the adaptations from the production source.
91 }92 // We are now in the range [1/2 ... 1] but the binary format uses [1 ... 2].93 exp2 -= 1;94 while F::EXP_MIN > exp2 {95 let mut n = (F::EXP_MIN - exp2) as usize;96 if n > MAX_SHIFT {97 n = MAX_SHIFT;98 }99 d.right_shift(n);100 exp2 += n as i32;101 }102 if (exp2 - F::EXP_MIN + 1) >= F::INFINITE_POWER {103 return fp_inf;104 }Aeneas declaration
The Lean below was mechanically extracted by Aeneas from Rust.
@[rust_loop]
def num.imp.dec2flt.slow.parse_long_mantissa_loop2
{F : Type} {Clause0_Int : Type} (traitsFloatInst : num.imp.traits.Float F
Clause0_Int) (d : num.imp.dec2flt.decimal_seq.DecimalSeq) (exp2 : Std.I32) :
Result (num.imp.dec2flt.decimal_seq.DecimalSeq × Std.I32)
:= do
loop
(fun (d1, exp21) => num.imp.dec2flt.slow.parse_long_mantissa_loop2.body
traitsFloatInst d1 exp21)
(d, exp2)Other extracted objects at this span
Source details
| Declaration | num.imp.dec2flt.slow.parse_long_mantissa_loop2 |
|---|---|
| File | num/imp/../../dec2flt/slow.rs |
| Lines | 94:4–101:5 |
| Program version | Original program |