From 6b70c5d0e13c0f88d67aa2eb508b327b70bd4aa3 Mon Sep 17 00:00:00 2001 From: Peter Bex Date: Wed, 3 Mar 2021 07:48:46 +0100 Subject: [PATCH] Fix numerator and denominator error handling (fixes #1730) --- NEWS | 2 ++ library.scm | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) 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)) -- 2.20.1