From a9f2271a905d74db6aae76298540e39aec355304 Mon Sep 17 00:00:00 2001 From: Misomosi Date: Tue, 22 Oct 2024 21:27:39 -0400 Subject: [PATCH] Fix magnitude check in parse_f64_prefix --- core/strconv/strconv.odin | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/strconv/strconv.odin b/core/strconv/strconv.odin index b1155c22f..26a737bd1 100644 --- a/core/strconv/strconv.odin +++ b/core/strconv/strconv.odin @@ -1121,6 +1121,7 @@ parse_f64_prefix :: proc(str: string) -> (value: f64, nr: int, ok: bool) { break trunc_block } f := f64(mantissa) + f_abs := f if neg { f = -f } @@ -1132,7 +1133,7 @@ parse_f64_prefix :: proc(str: string) -> (value: f64, nr: int, ok: bool) { f *= pow10[exp-22] exp = 22 } - if f > 1e15 || f < 1e-15 { + if f_abs > 1e15 || f_abs < 1e-15 { break trunc_block } return f * pow10[exp], nr, true