From 5421f829a64f915fd3df96e434b2bdbfef6910f4 Mon Sep 17 00:00:00 2001 From: Brad Nelson Date: Fri, 11 Feb 2022 20:10:42 -0800 Subject: [PATCH] Fix parsing bug in floats. --- ueforth/common/core.h | 2 ++ ueforth/common/float_tests.fs | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/ueforth/common/core.h b/ueforth/common/core.h index ece7a6b..488c0aa 100644 --- a/ueforth/common/core.h +++ b/ueforth/common/core.h @@ -104,6 +104,8 @@ static cell_t fconvert(const char *pos, cell_t n, float *ret) { } else if (*pos == '.') { if (has_dot) { return 0; } has_dot = -1; + } else { + return 0; } ++pos; } diff --git a/ueforth/common/float_tests.fs b/ueforth/common/float_tests.fs index 8bf38ef..6836950 100644 --- a/ueforth/common/float_tests.fs +++ b/ueforth/common/float_tests.fs @@ -99,3 +99,8 @@ e: test-afliteral foo out: 123.000000 ;e + +e: test-float-broken-parse + internals + s" teste" f>number? 0= assert +;e