From da93315e8529154f67f6c3a9667585dd18fe5d21 Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Wed, 28 Nov 2018 05:33:23 +0000 Subject: [PATCH] Re-enable invalid-operation traps here and fix the one broken test. Should maybe add a flo:safe-zero?, or decide that flo:zero? is the quiet version and (flo:= x 0.) is the signalling one. --- tests/runtime/test-flonum.scm | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/tests/runtime/test-flonum.scm b/tests/runtime/test-flonum.scm index ef380e254..4fb01afe2 100644 --- a/tests/runtime/test-flonum.scm +++ b/tests/runtime/test-flonum.scm @@ -41,12 +41,10 @@ USA. (f))) (define (yes-traps f) - #; (if (flo:have-trap-enable/disable?) - (flo:with-trapped-exceptions (flo:trappable-exceptions) f) - (f)) - ;; XXX Temporary workaround for my setup. - (no-traps f)) + ;; XXX Should enable all traps. + (flo:with-trapped-exceptions (flo:exception:invalid-operation) f) + (f))) (define subnormal+ flo:smallest-positive-subnormal) (define subnormal- (no-traps (lambda () (- subnormal+)))) @@ -104,10 +102,15 @@ USA. (,subnormal+ #f) (+1. #f) (+inf.0 #f) - (+nan.0 #f)) + ;; (+nan.0 #f) ; exception + ) (lambda (x v) (assert-eqv (yes-traps (lambda () (flo:zero? x))) v))) +(define-test 'nan-is-not-zero + (lambda () + (assert-false (no-traps (lambda () (flo:zero? (flo:nan.0))))))) + (define-enumerated-test 'subnormal? `((-inf.0 #f) (-1. #f) -- 2.25.1