| ... |
... |
@@ -115,6 +115,45 @@ |
|
115
|
115
|
(assert-error 'floating-point-inexact
|
|
116
|
116
|
(kernel:%sinh x)))))
|
|
117
|
117
|
|
|
|
118
|
+(define-test %sinhf.exceptions
|
|
|
119
|
+ (:tag :fdlibm)
|
|
|
120
|
+ (assert-error 'floating-point-overflow
|
|
|
121
|
+ (kernel:%sinhf 100f0))
|
|
|
122
|
+ (assert-error 'floating-point-overflow
|
|
|
123
|
+ (kernel:%sinhf -100f0))
|
|
|
124
|
+ (assert-error 'floating-point-invalid-operation
|
|
|
125
|
+ (kernel:%sinhf *snan-single-float*))
|
|
|
126
|
+ (assert-true (ext:float-nan-p (kernel:%sinhf *qnan-single-float*)))
|
|
|
127
|
+
|
|
|
128
|
+ ;; Same, but with overflow's masked
|
|
|
129
|
+ (ext:with-float-traps-masked (:overflow)
|
|
|
130
|
+ (assert-equal ext:single-float-positive-infinity
|
|
|
131
|
+ (kernel:%sinhf 100f0))
|
|
|
132
|
+ (assert-equal ext:single-float-negative-infinity
|
|
|
133
|
+ (kernel:%sinhf -100f0))
|
|
|
134
|
+ (assert-equal ext:single-float-positive-infinity
|
|
|
135
|
+ (kernel:%sinhf ext:single-float-positive-infinity))
|
|
|
136
|
+ (assert-equal ext:single-float-negative-infinity
|
|
|
137
|
+ (kernel:%sinhf ext:single-float-negative-infinity)))
|
|
|
138
|
+ ;; Test NaN
|
|
|
139
|
+ (ext:with-float-traps-masked (:invalid)
|
|
|
140
|
+ (assert-true (ext:float-nan-p (kernel:%sinhf *qnan-single-float*))))
|
|
|
141
|
+ ;; sinh(x) = x + x^3/6 + o(x^3). Thus, if |x| < 2^-17, sinh(x) = x,
|
|
|
142
|
+ ;; but we should signal inexact except if x is 0. We're not trying
|
|
|
143
|
+ ;; to get the exact value where sinh(x) = x. Just something
|
|
|
144
|
+ ;; obviously small enough.
|
|
|
145
|
+ (let ((x (scale-float 1f0 -29))
|
|
|
146
|
+ (x0 0f0))
|
|
|
147
|
+ (ext:with-float-traps-enabled (:inexact)
|
|
|
148
|
+ ;; This must not throw an inexact exception because the result
|
|
|
149
|
+ ;; is exact when the arg is 0.
|
|
|
150
|
+ (assert-eql 0f0 (kernel:%sinhf x0)))
|
|
|
151
|
+ (ext:with-float-traps-enabled (:inexact)
|
|
|
152
|
+ ;; This must throw an inexact exception for non-zero x even
|
|
|
153
|
+ ;; though the result is exactly x.
|
|
|
154
|
+ (assert-error 'floating-point-inexact
|
|
|
155
|
+ (kernel:%sinhf x)))))
|
|
|
156
|
+
|
|
118
|
157
|
(define-test %tanh.exceptions
|
|
119
|
158
|
(:tag :fdlibm)
|
|
120
|
159
|
(assert-true (ext:float-nan-p (kernel:%tanh *qnan*)))
|
| ... |
... |
@@ -130,6 +169,23 @@ |
|
130
|
169
|
(assert-error 'floating-point-inexact
|
|
131
|
170
|
(kernel:%tanh x)))))
|
|
132
|
171
|
|
|
|
172
|
+(define-test %tanhf.exceptions
|
|
|
173
|
+ (:tag :fdlibm)
|
|
|
174
|
+ (assert-true (ext:float-nan-p (kernel:%tanhf *qnan-single-float*)))
|
|
|
175
|
+ (assert-error 'floating-point-invalid-operation
|
|
|
176
|
+ (kernel:%tanhf *snan-single-float*))
|
|
|
177
|
+ (ext:with-float-traps-masked (:invalid)
|
|
|
178
|
+ (assert-true (ext:float-nan-p (kernel:%tanhf *snan-single-float*))))
|
|
|
179
|
+ ;; tanhf(x) = +/- 1 for |x| > 9.1, raising inexact, always. The
|
|
|
180
|
+ ;; exact value from cr_tanhf appears to be 0x41102cb3u. That is
|
|
|
181
|
+ ;; 9.010913.
|
|
|
182
|
+ (let ((x 9.1f0))
|
|
|
183
|
+ (ext:with-float-traps-enabled (:inexact)
|
|
|
184
|
+ ;; This must throw an inexact exception for non-zero x even
|
|
|
185
|
+ ;; though the result is exactly x.
|
|
|
186
|
+ (assert-error 'floating-point-inexact
|
|
|
187
|
+ (kernel:%tanhf x)))))
|
|
|
188
|
+
|
|
133
|
189
|
(define-test %acosh.exceptions
|
|
134
|
190
|
(:tag :fdlibm)
|
|
135
|
191
|
(assert-error 'floating-point-overflow
|