Source context

Program Rust

parse_scientific_loop

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

142         // and the first nondigit remains in the returned suffix, so the caller143         // performs the same whole-input validation even after updates stop.144         let mut count = 0;145         while count < s.len() && s[count].wrapping_sub(b'0') < 10 {146             let digit = s[count].wrapping_sub(b'0');147             if exponent < (1_i64 << 59) {148                 exponent = 10 * exponent + digit as i64;149             }150             count += 1;151         }152         *s_ref = &s[count..];153         if negative { Some(-exponent) } else { Some(exponent) }154     } else {

Aeneas declaration

The Lean below was mechanically extracted by Aeneas from Rust.

@[rust_loop]
def num.imp.dec2flt.parse.parse_scientific_loop
  (exponent : Std.I64) (s : Slice Std.U8) (count : Std.Usize) :
  Result (Std.I64 × Std.Usize)
  := do
  loop
    (fun (exponent1, count1) =>
      num.imp.dec2flt.parse.parse_scientific_loop.body s exponent1 count1)
    (exponent, count)
Operations used here

body · Program Rust

Other extracted objects at this span

num.imp.dec2flt.parse.parse_scientific_loop.body

Source details
Declarationnum.imp.dec2flt.parse.parse_scientific_loop
Filenum/imp/../../dec2flt/parse.rs
Lines145:8–151:9
Program versionRevised program