Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
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
61b33de4
Commit
61b33de4
authored
Dec 22, 2016
by
Daniel Kochmański
Browse files
number: atan: be more precise with judging pi
parent
0808c9fe
Changes
1
Show whitespace changes
Inline
Side-by-side
numbers/atan.lsp
View file @
61b33de4
...
...
@@ -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))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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