Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
justinethier committed Nov 28, 2023
1 parent 4d902f9 commit 08bd333
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
10 changes: 5 additions & 5 deletions tests/base.scm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 08bd333

Please sign in to comment.