mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 07:38:48 +00:00
Fix %e printing incorrect precision
For example, `%.2e` with 30.56 as the value would produce `30.60e+01`, as opposed to C's printf producing `30.6e+01`.
This commit is contained in:
@@ -104,8 +104,7 @@ generic_ftoa :: proc(buf: []byte, val: f64, fmt: byte, precision, bit_size: int)
|
|||||||
} else {
|
} else {
|
||||||
switch fmt {
|
switch fmt {
|
||||||
case 'e', 'E':
|
case 'e', 'E':
|
||||||
prec += 1
|
decimal.round(d, prec + 1)
|
||||||
decimal.round(d, prec)
|
|
||||||
case 'f', 'F':
|
case 'f', 'F':
|
||||||
decimal.round(d, d.decimal_point+prec)
|
decimal.round(d, d.decimal_point+prec)
|
||||||
case 'g', 'G':
|
case 'g', 'G':
|
||||||
|
|||||||
Reference in New Issue
Block a user