Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Karsten Poeck
ansi-test
Commits
c805bab9
Commit
c805bab9
authored
Dec 22, 2016
by
Daniel Kochmański
Browse files
numbers: atan: test signed zero case
parent
a212df0d
Changes
1
Hide whitespace changes
Inline
Side-by-side
numbers/atan.lsp
View file @
c805bab9
...
...
@@ -155,16 +155,34 @@
(remove-if #'zerop *floats*)))))
T)
;;; We could have tested also for infinities and signed 0, but there
;;; is no portable ieee-fp, we could put it in ansi-beyond test suite
(deftest atan.ieee.2 :description "Verify ATAN handling signed zero"
(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:
;;;
;;; (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 nan (anything)) -> nan
;;; (atan +-inf +inf) -> +-pi/4
...
...
@@ -173,7 +191,6 @@
;;; (atan +-(anything-but-inf/nan), -inf) -> +-pi
;;; (atan +-inf (anything-but-0/nan/inf)) -> +-pi/2
;;;
;;; (deftest atan.ieee.2 t t)
;;; Error tests
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment