Skip to content
Snippets Groups Projects
Commit c805bab9 authored by Daniel Kochmański's avatar Daniel Kochmański
Browse files

numbers: atan: test signed zero case

parent a212df0d
No related branches found
No related tags found
No related merge requests found
...@@ -155,16 +155,34 @@ ...@@ -155,16 +155,34 @@
(remove-if #'zerop *floats*))))) (remove-if #'zerop *floats*)))))
T) T)
;;; We could have tested also for infinities and signed 0, but there (deftest atan.ieee.2 :description "Verify ATAN handling signed zero"
;;; is no portable ieee-fp, we could put it in ansi-beyond test suite (or (plusp (float-sign -0.0))
(flet ((-zerop (elt)
(and (zerop elt)
(minusp (float-sign elt))))
(+zerop (elt)
(and (zerop elt)
(plusp (float-sign elt))))
(-pi-p (elt) (< (abs (+ pi elt)) 0.01))
(+pi-p (elt) (< (abs (- pi elt)) 0.01)))
(and
(+zerop (atan +0.0 +0.0))
(-zerop (atan -0.0 +0.0))
(+pi-p (atan +0.0 -0.0))
(-pi-p (atan -0.0 -0.0))
(every #'identity
(map 'list (lambda (n)
(and (-zerop (atan -0.0 n))
(+zerop (atan +0.0 n))
(+pi-p (atan +0.0 (- n)))
(-pi-p (atan -0.0 (- n)))))
(remove-if-not #'plusp *floats*))))))
T)
;;; We could have tested also for infinities and nan's, but there is
;;; no portable ieee-fp, we could put it in ansi-beyond test suite
;;; though: ;;; though:
;;; ;;;
;;; (atan +0.0 -anything-but-0/nan/inf) -> +pi
;;; (atan -0.0 -anything-but-0/nan/inf) -> -pi
;;; (atan +0.0 +0.0) -> +0.0
;;; (atan -0.0 +0.0) -> -0.0
;;; (atan +0.0 -0.0) -> +pi
;;; (atan -0.0 -0.0) -> -pi
;;; (atan (anything) nan) -> nan ;;; (atan (anything) nan) -> nan
;;; (atan nan (anything)) -> nan ;;; (atan nan (anything)) -> nan
;;; (atan +-inf +inf) -> +-pi/4 ;;; (atan +-inf +inf) -> +-pi/4
...@@ -173,7 +191,6 @@ ...@@ -173,7 +191,6 @@
;;; (atan +-(anything-but-inf/nan), -inf) -> +-pi ;;; (atan +-(anything-but-inf/nan), -inf) -> +-pi
;;; (atan +-inf (anything-but-0/nan/inf)) -> +-pi/2 ;;; (atan +-inf (anything-but-0/nan/inf)) -> +-pi/2
;;; ;;;
;;; (deftest atan.ieee.2 t t)
;;; Error tests ;;; Error tests
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment