Skip to content

Commit c2c71a2

Browse files
committed
Merge pull request #8 from clarus/master
Bug fixes for conversions from integers to strings.
2 parents f6da121 + 56295f9 commit c2c71a2

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

theories/Data/Char.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ Definition digit2ascii (n:nat) : Ascii.ascii :=
6464
| 7 => "7"
6565
| 8 => "8"
6666
| 9 => "9"
67-
| n => ascii_of_nat (n - 9 + nat_of_ascii "A")
67+
| n => ascii_of_nat (n - 10 + nat_of_ascii "A")
6868
end%char.
6969

7070
Definition chr_newline : ascii :=

theories/Data/String.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ Section Program_Scope.
9090
| true => fun _ => String (digit2ascii n) EmptyString
9191
| false => fun pf =>
9292
let m := NPeano.div n mod in
93-
append (nat2string m) (String (digit2ascii (n - 10 * m)) EmptyString)
93+
append (nat2string m) (String (digit2ascii (n - mod * m)) EmptyString)
9494
end eq_refl.
9595
Next Obligation.
9696
eapply NPeano.Nat.div_lt; auto.

0 commit comments

Comments
 (0)