Commit 4915f467 authored by Raymond Toy's avatar Raymond Toy

Remove unused vars in WITH-FLOAT-TRAPS macro*

The TRAPS and EXCEPTION vars in the WITH-FLOAT-TRAPS were unused.
Remove them.

Also add some tests for WITH-FLOAT-TRAPS-MASKED to verify that the
traps are masked.
parent 0a2e45d4
Pipeline #318 passed with stage
in 16 minutes and 51 seconds
......@@ -445,9 +445,7 @@
`(progn
(defmacro ,macro-name (traps &body body)
,docstring
(let ((traps (dpb (float-trap-mask traps) float-traps-byte 0))
(exceptions (dpb (float-trap-mask traps) float-sticky-bits 0))
(trap-mask (dpb (lognot (float-trap-mask traps))
(let ((trap-mask (dpb (lognot (float-trap-mask traps))
float-traps-byte #xffffffff))
(exception-mask (dpb (lognot (vm::float-trap-mask traps))
float-sticky-bits #xffffffff))
......
......@@ -116,3 +116,25 @@
f
e)))))
(define-test float-traps-masked
;; inf-inf signals invalid, which is masked so the result is NaN.
(assert-true
(ext:float-nan-p
(ext:with-float-traps-masked (:invalid)
(- ext:double-float-positive-infinity
ext:double-float-positive-infinity))))
;; Divide-by-zero is masked so dividing by zero returns infinity
(assert-true
(ext:float-infinity-p
(ext:with-float-traps-masked (:divide-by-zero)
(/ 100d0 0d0))))
;; Overflow is masked so 100 * most-positive-double returns infinity
(assert-true
(ext:float-infinity-p
(ext:with-float-traps-masked (:overflow)
(* 100 most-negative-double-float)))))
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment