From: Taylor R Campbell Date: Sun, 25 Aug 2019 18:32:03 +0000 (+0000) Subject: Simplify flo:-inf.0 and flo:+inf.0. X-Git-Tag: mit-scheme-pucked-10.1.20~11^2~67 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=e0dc8ee501afa84dd36dd85d8edbcc1db7a88ad6;p=mit-scheme.git Simplify flo:-inf.0 and flo:+inf.0. We have put out a release now whose reader understands +inf.0/-inf.0, so we should be able to use the notation. Fixes bugs with incorrectly raising the divide-by-zero exception flag (even if no trap), e.g.: ;|log1mexp-invalid/(4.9406564584124654e-324)| failed 1 sub-tests out of 1 in 0. seconds: assertion 3: value was 3 but expected an object eqv? to 1 Here 3 = (invalid-operation divide-by-zero), 1 = (invalid-operation) [aarch64]. --- diff --git a/src/runtime/floenv.scm b/src/runtime/floenv.scm index db188d25f..fc6254859 100644 --- a/src/runtime/floenv.scm +++ b/src/runtime/floenv.scm @@ -156,7 +156,6 @@ USA. ((ucode-primitive set-trapped-float-exceptions 1) (flo:default-trapped-exceptions)) ((ucode-primitive float-environment 0))))) - (initialize-flonum-infinities!) unspecific) (define (initialize-package!) @@ -355,24 +354,5 @@ USA. (define (flo:nan.0) (flo:make-nan #f #t 0)) -(define flo:+inf.0) -(define flo:-inf.0) -(define (initialize-flonum-infinities!) - (if (flo:have-trap-enable/disable?) - (begin - (set! flo:+inf.0 - (named-lambda (flo:+inf.0) - (flo:with-exceptions-untrapped (flo:exception:divide-by-zero) - (lambda () - (flo:/ +1. 0.))))) - (set! flo:-inf.0 - (named-lambda (flo:-inf.0) - (flo:with-exceptions-untrapped (flo:exception:divide-by-zero) - (lambda () - (flo:/ -1. 0.))))) - unspecific) - ;; This works on macOS. YMMV. - (begin - (set! flo:+inf.0 (named-lambda (flo:+inf.0) (flo:/ +1. 0.))) - (set! flo:-inf.0 (named-lambda (flo:-inf.0) (flo:/ -1. 0.))) - unspecific))) \ No newline at end of file +(define (flo:+inf.0) +inf.0) +(define (flo:-inf.0) -inf.0) \ No newline at end of file