Commit 0d53bc7f authored by Raymond Toy's avatar Raymond Toy
Browse files

Merge branch 'master' into rtoy-setexception-inexact

parents a53d7ef4 507f6d9e
......@@ -14,6 +14,15 @@
(kernel:make-double-float #x7ff00000 1)
"A randon signaling MaN value")
(defmacro with-inexact-exception-enabled (&body body)
(let ((old-modes (gensym "OLD-MODES-")))
`(let ((,old-modes (ext:get-floating-point-modes)))
(ext:set-floating-point-modes :traps '(:inexact))
(apply 'ext:set-floating-point-modes ,old-modes)))))
(define-test %cosh.exceptions
(:tag :fdlibm)
(assert-error 'floating-point-overflow
......@@ -285,10 +294,20 @@
(:tag :fdlibm)
(assert-eql -0d0 (asinh -0d0))
(assert-eql 0d0 (asinh 0d0))
(let ((x (scale-float 1d0 -29)))
(let ((x (scale-float 1d0 -29))
(x0 0d0))
;; asinh(x) = x for x < 2^-28
(assert-eql x (asinh x))
(assert-eql (- x) (asinh (- x))))
(assert-eql (- x) (asinh (- x)))
;; This must not throw an inexact exception because the result
;; is exact when the arg is 0.
(assert-eql 0d0 (asinh x0)))
;; This must throw an inexact exception for non-zero x even
;; though the result is exactly x.
(assert-error 'floating-point-inexact
(asinh x))))
(let ((x (scale-float 1d0 -28)))
;; Case 2 > |x| >= 2^-28
(assert-eql 3.725290298461914d-9 (asinh x))
Supports Markdown
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