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

number: atan: be more precise with judging pi

parent 0808c9fe
No related branches found
No related tags found
No related merge requests found
......@@ -128,9 +128,9 @@
;;; ieee-fp tests
(deftest atan.ieee.1 :description "Verify if atan handles 0.0 correctly"
(flet ((+pi-p (elt) (< (abs (- pi elt)) 0.01))
(+pi/2-p (elt) (< (abs (- (/ pi 2) elt)) 0.01))
(-pi/2-p (elt) (< (abs (+ (/ pi 2) elt)) 0.01)))
(flet ((+pi-p (elt) (= (coerce pi (type-of elt)) elt))
(+pi/2-p (elt) (approx= (coerce (/ pi +2) (type-of elt)) elt))
(-pi/2-p (elt) (approx= (coerce (/ pi -2) (type-of elt)) elt)))
;; (atan +-0 +(anything-but-nan)) -> +-0
;; (atan +-0 -(anything-but-nan)) -> +-pi
;; (atan +-(anything-but-0/nan) 0) -> +-pi/2
......@@ -155,8 +155,8 @@
(-zerop (elt)
(and (zerop elt)
(minusp (float-sign elt))))
(+pi-p (elt) (< (abs (- pi elt)) 0.01))
(-pi-p (elt) (< (abs (+ pi elt)) 0.01)))
(+pi-p (elt) (= (coerce pi (type-of elt)) elt))
(-pi-p (elt) (= (coerce pi (type-of elt)) (- elt))))
(and
(+zerop (atan +0.0 +0.0))
(-zerop (atan -0.0 +0.0))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment