From: Taylor R Campbell Date: Fri, 16 Nov 2018 17:00:10 +0000 (+0000) Subject: Make flo:integer? answer true only for finite inputs. X-Git-Tag: mit-scheme-pucked-10.1.2~16^2~68 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=fef97700a33ba4eaab3341487f109bde488e08eb;p=mit-scheme.git Make flo:integer? answer true only for finite inputs. --- 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