Source context

Program Rust

round_loop

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

103         let dp = self.decimal_point as usize;104         let mut n = 0_u64;105 106         for i in 0..dp {107             n *= 10;108             if i < self.num_digits {109                 n += self.digits[i] as u64;110             }111         }112 113         let mut round_up = false;114 

Aeneas declaration

The Lean below was mechanically extracted by Aeneas from Rust.

@[rust_loop]
def num.imp.dec2flt.decimal_seq.DecimalSeq.round_loop
  (iter : core.ops.range.Range Std.Usize) (i : Std.Usize)
  (a : Array Std.U8 768#usize) (n : Std.U64) :
  Result Std.U64
  := do
  loop
    (fun (iter1, n1) => num.imp.dec2flt.decimal_seq.DecimalSeq.round_loop.body
      i a iter1 n1)
    (iter, n)
Operations used here

body · Program Rust

Other extracted objects at this span

num.imp.dec2flt.decimal_seq.DecimalSeq.round_loop.body

Source details
Declarationnum.imp.dec2flt.decimal_seq.DecimalSeq.round_loop
Filenum/imp/../../dec2flt/decimal_seq.rs
Lines106:8–111:9
Program versionOriginal program