aboutsummaryrefslogtreecommitdiff
path: root/src/stdlib/reals.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-11-15 14:33:15 -0500
committerBruce Hill <bruce@bruce-hill.com>2025-11-15 14:33:15 -0500
commit630f910563b6f27dd34a4a0496a43d32539eadcb (patch)
tree3670080722d53ff70a688cff395152e70273434e /src/stdlib/reals.c
parentfc91166ce8590e67404cde79a273d7022ec16f1c (diff)
Incremental fixes
Diffstat (limited to 'src/stdlib/reals.c')
-rw-r--r--src/stdlib/reals.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/stdlib/reals.c b/src/stdlib/reals.c
index 1c4be751..cfa027d1 100644
--- a/src/stdlib/reals.c
+++ b/src/stdlib/reals.c
@@ -67,13 +67,13 @@ static Int_t Real$compute_double(Real_t r, int64_t precision) {
public
OptionalReal_t Real$parse(Text_t text, Text_t *remainder) {
- Text_t decimal_onwards;
+ Text_t decimal_onwards = EMPTY_TEXT;
OptionalInt_t int_component = Int$parse(text, &decimal_onwards);
if (int_component.small == 0) int_component = I(0);
- Text_t fraction_text;
+ Text_t fraction_text = EMPTY_TEXT;
if (Text$starts_with(decimal_onwards, Text("."), &fraction_text)) {
fraction_text = Text$replace(fraction_text, Text("_"), EMPTY_TEXT);
- OptionalInt_t fraction = Int$parse(decimal_onwards, remainder);
+ OptionalInt_t fraction = Int$parse(fraction_text, remainder);
if (fraction.small == 0) return NONE_REAL;
int64_t shift = fraction_text.length;
Int_t scale = Int$power(I(10), I(shift));
@@ -106,9 +106,9 @@ double Real$as_float64(Real_t x) {
if (((orig_exp + exp_adj) & ~0x7fful) != 0) {
// overflow
if (scaled_int.d < 0.0) {
- return -INFINITY;
+ return (double)-INFINITY;
} else {
- return INFINITY;
+ return (double)INFINITY;
}
}
scaled_int.bits += exp_adj << 52;