From: Taylor R Campbell Date: Thu, 8 Nov 2018 07:42:50 +0000 (+0000) Subject: Follow IEEE 754 semantics: disable floating-point traps by default. X-Git-Tag: mit-scheme-pucked-10.1.2~16^2~116^2~15 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=2a55da8a55730304aab7b5cbcc93c9894fe8eead;p=mit-scheme.git Follow IEEE 754 semantics: disable floating-point traps by default. --- diff --git a/src/runtime/floenv.scm b/src/runtime/floenv.scm index dc40d4d04..d4d478ee3 100644 --- a/src/runtime/floenv.scm +++ b/src/runtime/floenv.scm @@ -271,21 +271,17 @@ USA. ((ucode-primitive defer-float-exception-traps 0))) (define (flo:default-trapped-exceptions) - ;; By default, we trap the standard IEEE 754 exceptions that Scheme - ;; can safely run with trapped, in order to report errors as soon as - ;; they happen. Scheme cannot safely run with the inexact result - ;; exception trapped (which you almost never want anyway), and there - ;; are some non-standard exceptions which we will not trap in order - ;; to keep behaviour consistent between host systems. + ;; By default, we trap nothing, following iEEE 754-2008's default + ;; exception handling recommendation. ;; - ;; XXX If you want to read the exceptions that don't trap by default, - ;; you must disable interrupts so that the lazy floating-point - ;; environment switching mechanism will work. Is that too much of a - ;; burden? - (fix:or (fix:or (flo:exception:divide-by-zero) - (flo:exception:invalid-operation)) - (fix:or (flo:exception:overflow) - (flo:exception:underflow)))) + ;; This is a change from the past in MIT Scheme which used to trap + ;; all the standard exceptions except for inexact-result. + ;; + ;; Note that for querying the status of floating-point operations, + ;; the floating-point environment is not reliable in the current + ;; thread until you touch it, e.g. with flo:clear-exceptions! or + ;; flo:preserving-environment. + 0) ;++ Include machine-dependent bits, by number rather than by name.