From 08bd3337013ced273ff0b66e24658c0970b22484 Mon Sep 17 00:00:00 2001 From: Justin Ethier Date: Mon, 27 Nov 2023 18:59:42 -0800 Subject: [PATCH] Cleanup --- runtime.c | 3 ++- tests/base.scm | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/runtime.c b/runtime.c index adde13fd..98576602 100644 --- a/runtime.c +++ b/runtime.c @@ -2657,7 +2657,8 @@ object Cyc_string2number_(void *data, object cont, object str) if (rv == STR2INT_SUCCESS) { _return_closcall1(data, cont, obj_int2obj(result)); } else if (rv == STR2INT_RATIONAL || - // TODO: is there a more efficient way? + // Could still be a rational if numerator is + // bignum, so in that case do one more scan ((rv == STR2INT_OVERFLOW || rv == STR2INT_UNDERFLOW) && strchr(s, '/') != NULL)) { double d = string2rational(data, s); diff --git a/tests/base.scm b/tests/base.scm index 4fd5496d..506a46b8 100644 --- a/tests/base.scm +++ b/tests/base.scm @@ -48,6 +48,11 @@ "rationals" (test 3.0 (numerator (/ 6 4))) (test 2.0 (denominator (/ 6 4))) + (test 3.0 (expt 81 1/4)) + (test #t + (< 1.0e+40 + (/ 33333333333333333333333333333333333333333 3.0) + 1.2e+40)) ) (test-group @@ -71,11 +76,6 @@ ;(test +inf.0 (exact +inf.0)) ) -(test-group - "rationals" - (test 3.0 (expt 81 1/4)) -) - (test-group "records" (define-record-type employee