~ chicken-core (chicken-5) cb91806626e81bfdebb3917fa779ec3922673672
commit cb91806626e81bfdebb3917fa779ec3922673672
Author: Peter Bex <peter@more-magic.net>
AuthorDate: Wed Mar 3 07:48:46 2021 +0100
Commit: Mario Domenech Goulart <mario@parenteses.org>
CommitDate: Sat Mar 6 11:14:07 2021 +0100
Fix numerator and denominator error handling (fixes #1730)
Signed-off-by: Mario Domenech Goulart <mario@parenteses.org>
diff --git a/NEWS b/NEWS
index ed90ec42..18c225c5 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,8 @@
5.2.1
- Core libraries
+ - Fixed an inadvertant error during error reporting in the `numerator`
+ and `denominator` procedures when passed non-finite flonums (#1730).
- Fixed a bug where optimisations for `irregex-match?` would cause
runtime errors due to the inlined specialisations not being
fully-expanded (see #1690).
diff --git a/library.scm b/library.scm
index 208d29c4..95e5797b 100644
--- a/library.scm
+++ b/library.scm
@@ -1789,7 +1789,7 @@ EOF
(lambda (n)
(cond ((exact-integer? n) n)
((##core#inline "C_i_flonump" n)
- (cond ((not (finite? n)) (bad-inexact 'numerator n))
+ (cond ((not (finite? n)) (##sys#error-bad-inexact n 'numerator))
((##core#inline "C_u_i_fpintegerp" n) n)
(else (exact->inexact (numerator (inexact->exact n))))))
((ratnum? n) (%ratnum-numerator n))
@@ -1801,7 +1801,7 @@ EOF
(lambda (n)
(cond ((exact-integer? n) 1)
((##core#inline "C_i_flonump" n)
- (cond ((not (finite? n)) (bad-inexact 'denominator n))
+ (cond ((not (finite? n)) (##sys#error-bad-inexact n 'denominator))
((##core#inline "C_u_i_fpintegerp" n) 1.0)
(else (exact->inexact (denominator (inexact->exact n))))))
((ratnum? n) (%ratnum-denominator n))
Trap