From f7f2272c50f2eb1f9e200de05cdb6b4965ec8104 Mon Sep 17 00:00:00 2001 From: Ginger Bill Date: Sun, 7 May 2017 11:42:27 +0100 Subject: [PATCH] Fix `fmt_float` precision --- core/fmt.odin | 7 ++++--- core/strconv.odin | 1 - 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/core/fmt.odin b/core/fmt.odin index c0418ad31..e5fdafd5c 100644 --- a/core/fmt.odin +++ b/core/fmt.odin @@ -628,9 +628,10 @@ fmt_float :: proc(fi: ^Fmt_Info, v: f64, bit_size: int, verb: rune) { if fi.prec_set { prec = fi.prec; } - buf: [128]byte; + + buf: [386]byte; str := strconv.append_float(buf[1..<1], v, 'f', prec, bit_size); - str = string(buf[0.. len(str) { write_byte(fi.buf, str[0]); fmt_write_padding(fi, fi.width - len(str)); - write_string(fi.buf, str[1..<]); + write_string(fi.buf, str[1..]); } else { _pad(fi, str); } diff --git a/core/strconv.odin b/core/strconv.odin index 95f86b86b..9c51b0573 100644 --- a/core/strconv.odin +++ b/core/strconv.odin @@ -1,5 +1,4 @@ #import . "decimal.odin"; -#import "math.odin"; Int_Flag :: enum { PREFIX = 1<<0,