This commit is contained in:
Justin Ethier 2023-11-27 18:59:42 -08:00
parent 4d902f9a77
commit 08bd333701
2 changed files with 7 additions and 6 deletions

View file

@ -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);

View file

@ -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