mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-09 15:19:07 +00:00
fix some inaccuracy in float printing
This commit is contained in:
parent
a6c2b013fd
commit
3fd6c0ce25
1 changed files with 3 additions and 1 deletions
|
|
@ -332,7 +332,7 @@ pub fn buf_print_f64(out_buf: []u8, x: f64, decimals: isize) -> isize {
|
||||||
|
|
||||||
var a: isize = 1;
|
var a: isize = 1;
|
||||||
var i: isize = 0;
|
var i: isize = 0;
|
||||||
while (i < decs) {
|
while (i < decs + 5) {
|
||||||
a *= 10;
|
a *= 10;
|
||||||
i += 1;
|
i += 1;
|
||||||
}
|
}
|
||||||
|
|
@ -350,6 +350,8 @@ pub fn buf_print_f64(out_buf: []u8, x: f64, decimals: isize) -> isize {
|
||||||
i -= 1;
|
i -= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dec_num /= 100000;
|
||||||
|
|
||||||
len += decs;
|
len += decs;
|
||||||
|
|
||||||
i = len - 1;
|
i = len - 1;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue