From ea9fe397e572b33f4db70a878ef7c5fc6b8c5d43 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Mon, 23 Jan 2023 12:46:03 +0000 Subject: Fix typo in `decimal_to_float_bits` --- core/strconv/generic_float.odin | 8 ++++---- core/strconv/strconv.odin | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/core/strconv/generic_float.odin b/core/strconv/generic_float.odin index 489124fbf..78edf5ca8 100644 --- a/core/strconv/generic_float.odin +++ b/core/strconv/generic_float.odin @@ -287,13 +287,13 @@ round_shortest :: proc(d: ^decimal.Decimal, mant: u64, exp: int, flt: ^Float_Inf @(private) decimal_to_float_bits :: proc(d: ^decimal.Decimal, info: ^Float_Info) -> (b: u64, overflow: bool) { - end :: proc "contextless" (d: ^decimal.Decimal, mant: u64, exp: int, info: ^Float_Info) -> (b: u64) { - bits := mant & (u64(1)< (bits: u64) { + bits = mant & (u64(1)< bool { mant^ = 0 @@ -303,7 +303,7 @@ decimal_to_float_bits :: proc(d: ^decimal.Decimal, info: ^Float_Info) -> (b: u64 mant: u64 exp: int - if d.decimal_point == 0 { + if d.count == 0 { mant = 0 exp = info.bias b = end(d, mant, exp, info) diff --git a/core/strconv/strconv.odin b/core/strconv/strconv.odin index 0f27d5a1d..6d7374760 100644 --- a/core/strconv/strconv.odin +++ b/core/strconv/strconv.odin @@ -819,7 +819,7 @@ parse_f64 :: proc(str: string, n: ^int = nil) -> (value: f64, ok: bool) { } if mantissa>>_f64_info.mantbits != 0 { - return + break trunc_block } f := f64(mantissa) if neg { @@ -841,7 +841,6 @@ parse_f64 :: proc(str: string, n: ^int = nil) -> (value: f64, ok: bool) { return f / pow10[-exp], true } } - d: decimal.Decimal decimal.set(&d, str[:nr]) b, overflow := decimal_to_float_bits(&d, &_f64_info) -- cgit v1.2.3