Source context

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)
Operations used here

Float · Program Rust

DecimalSeq · Program Rust

body · Program Rust

Other extracted objects at this span

num.imp.dec2flt.slow.parse_long_mantissa_loop2.body

Source details
Declarationnum.imp.dec2flt.slow.parse_long_mantissa_loop2
Filenum/imp/../../dec2flt/slow.rs
Lines94:4–101:5
Program versionOriginal program