diff options
| author | Feoramund <161657516+Feoramund@users.noreply.github.com> | 2024-06-04 13:24:46 -0400 |
|---|---|---|
| committer | Feoramund <161657516+Feoramund@users.noreply.github.com> | 2024-06-04 13:24:46 -0400 |
| commit | d33668fa91b0f64cb6f69f315a2b2e8609fdbee0 (patch) | |
| tree | f94ceec24036ab915687d958aa509f16c658e804 /core | |
| parent | 3b7100f8e5cdf325a51926ba02f785a5443b0415 (diff) | |
Fix partial parsing of "infinity" in `parse_f64_prefix`
It was previously reporting an invalid number of characters parsed for
any string other than "inf", "+inf", or "-inf".
Diffstat (limited to 'core')
| -rw-r--r-- | core/strconv/strconv.odin | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/core/strconv/strconv.odin b/core/strconv/strconv.odin index 94842617e..990b2be2f 100644 --- a/core/strconv/strconv.odin +++ b/core/strconv/strconv.odin @@ -878,13 +878,10 @@ parse_f64_prefix :: proc(str: string) -> (value: f64, nr: int, ok: bool) { s = s[1:] fallthrough case 'i', 'I': - n = common_prefix_len_ignore_case(s, "infinity") - if 3 < n && n < 8 { // "inf" or "infinity" - n = 3 - } - if n == 3 || n == 8 { + m := common_prefix_len_ignore_case(s, "infinity") + if m == 3 || m == 8 { // "inf" or "infinity" f = 0h7ff00000_00000000 if sign == 1 else 0hfff00000_00000000 - n = nsign + 3 + n = nsign + m ok = true return } |