Raymond Toy pushed to branch master at cmucl / cmucl
Commits:
-
4915f467
by Raymond Toy at 2018-07-22T10:14:55-07:00
2 changed files:
Changes:
... | ... | @@ -445,9 +445,7 @@ |
445 | 445 |
`(progn
|
446 | 446 |
(defmacro ,macro-name (traps &body body)
|
447 | 447 |
,docstring
|
448 |
- (let ((traps (dpb (float-trap-mask traps) float-traps-byte 0))
|
|
449 |
- (exceptions (dpb (float-trap-mask traps) float-sticky-bits 0))
|
|
450 |
- (trap-mask (dpb (lognot (float-trap-mask traps))
|
|
448 |
+ (let ((trap-mask (dpb (lognot (float-trap-mask traps))
|
|
451 | 449 |
float-traps-byte #xffffffff))
|
452 | 450 |
(exception-mask (dpb (lognot (vm::float-trap-mask traps))
|
453 | 451 |
float-sticky-bits #xffffffff))
|
... | ... | @@ -116,3 +116,25 @@ |
116 | 116 |
f
|
117 | 117 |
e)))))
|
118 | 118 |
|
119 |
+(define-test float-traps-masked
|
|
120 |
+ ;; inf-inf signals invalid, which is masked so the result is NaN.
|
|
121 |
+ (assert-true
|
|
122 |
+ (ext:float-nan-p
|
|
123 |
+ (ext:with-float-traps-masked (:invalid)
|
|
124 |
+ (- ext:double-float-positive-infinity
|
|
125 |
+ ext:double-float-positive-infinity))))
|
|
126 |
+ |
|
127 |
+ ;; Divide-by-zero is masked so dividing by zero returns infinity
|
|
128 |
+ (assert-true
|
|
129 |
+ (ext:float-infinity-p
|
|
130 |
+ (ext:with-float-traps-masked (:divide-by-zero)
|
|
131 |
+ (/ 100d0 0d0))))
|
|
132 |
+ |
|
133 |
+ ;; Overflow is masked so 100 * most-positive-double returns infinity
|
|
134 |
+ (assert-true
|
|
135 |
+ (ext:float-infinity-p
|
|
136 |
+ (ext:with-float-traps-masked (:overflow)
|
|
137 |
+ (* 100 most-negative-double-float)))))
|
|
138 |
+ |
|
139 |
+
|
|
140 |
+
|
|
\ No newline at end of file |