From fef97700a33ba4eaab3341487f109bde488e08eb Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Fri, 16 Nov 2018 17:00:10 +0000 Subject: [PATCH] Make flo:integer? answer true only for finite inputs. --- src/runtime/arith.scm | 3 ++- tests/runtime/test-arith.scm | 9 ++------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/runtime/arith.scm b/src/runtime/arith.scm index 583253e03..cd482a9db 100644 --- a/src/runtime/arith.scm +++ b/src/runtime/arith.scm @@ -891,7 +891,8 @@ USA. (declare (integrate flo:integer?)) (define (flo:integer? x) - (flo:= x (flo:round x))) + (and (flo:finite? x) + (flo:= x (flo:round x)))) (define (flo:rationalize x e) (flo:simplest-rational (flo:- x e) (flo:+ x e))) diff --git a/tests/runtime/test-arith.scm b/tests/runtime/test-arith.scm index f4177ec9d..c3033b9c2 100644 --- a/tests/runtime/test-arith.scm +++ b/tests/runtime/test-arith.scm @@ -401,12 +401,7 @@ USA. 1/2 0.1 1+2i - (flo:nan.0)) - assert-not-integer) - -(define-enumerated-test 'not-integer?/broken - (vector + (flo:nan.0) (flo:+inf.0) (flo:-inf.0)) - (lambda (x) - (expect-failure (lambda () (assert-not-integer x))))) \ No newline at end of file + assert-not-integer) \ No newline at end of file -- 2.25.1