From c5878cced02fd1ed7e7940eaf8eb8b4cce23a9d4 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sat, 13 Dec 2025 13:59:35 -0500 Subject: Fix some Real issues --- src/stdlib/reals.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/stdlib') diff --git a/src/stdlib/reals.c b/src/stdlib/reals.c index ba088bb6..40f4cf4c 100644 --- a/src/stdlib/reals.c +++ b/src/stdlib/reals.c @@ -61,8 +61,13 @@ OptionalReal_t Real$parse(Text_t text, Text_t *remainder) { 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(fraction_text, I(10), remainder); - if (fraction.small == 0) return NONE_REAL; + OptionalInt_t fraction; + if (fraction_text.length == 0) { + fraction = I(0); + } else { + fraction = Int$parse(fraction_text, I(10), remainder); + if (fraction.small == 0) return NONE_REAL; + } int64_t shift = fraction_text.length; Int_t scale = Int$power(I(10), I(shift)); Int_t i = Int$plus(Int$times(int_component, scale), fraction); -- cgit v1.2.3