aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHyp-X <hypxxx@gmail.com>2023-01-28 14:40:44 +0100
committerHyp-X <hypxxx@gmail.com>2023-01-28 14:40:44 +0100
commita3bb7d3028ab9e7768ea49208756bfb4a3489d76 (patch)
tree4aaacababa877a2e4ce198da6bc74508fcd397ba
parentc45ca1bfcccb9b8f001a62a52c56eeeb5c73be88 (diff)
Fix decimal_to_float_bits for floats >= 1
-rw-r--r--core/strconv/generic_float.odin2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/strconv/generic_float.odin b/core/strconv/generic_float.odin
index 78edf5ca8..b612b8eb2 100644
--- a/core/strconv/generic_float.odin
+++ b/core/strconv/generic_float.odin
@@ -326,7 +326,7 @@ decimal_to_float_bits :: proc(d: ^decimal.Decimal, info: ^Float_Info) -> (b: u64
exp = 0
for d.decimal_point > 0 {
n := 27 if d.decimal_point >= len(power_table) else power_table[d.decimal_point]
- decimal.shift(d, n)
+ decimal.shift(d, -n)
exp += n
}
for d.decimal_point < 0 || d.decimal_point == 0 && d.digits[0] < '5' {