[Git][cmucl/cmucl][master] Add atanh tests.
Raymond Toy
rtoy at common-lisp.net
Sat Dec 19 17:46:32 UTC 2015
Raymond Toy pushed to branch master at cmucl / cmucl
Commits:
fab01803 by Raymond Toy at 2015-12-19T09:46:21Z
Add atanh tests.
- - - - -
1 changed file:
- tests/fdlibm.lisp
Changes:
=====================================
tests/fdlibm.lisp
=====================================
--- a/tests/fdlibm.lisp
+++ b/tests/fdlibm.lisp
@@ -310,6 +310,26 @@
(assert-eql 710.4758600739439d0 (asinh x))
(assert-eql -710.4758600739439d0 (asinh (- x)))))
-
-
-
\ No newline at end of file
+(define-test atanh-basic-tests
+ (:tag :fdlibm)
+ (assert-eql +0d0 (atanh +0d0))
+ (assert-eql -0d0 (atanh -0d0))
+ ;; atanh(x) = x, |x| < 2^-28
+ (let ((x (scale-float 1d0 -29)))
+ (assert-eql x (atanh x))
+ (assert-eql (- x) (atanh (- x))))
+ ;; atanh(0.25) = log(5/3)/2, |x| < 0.5
+ (let ((x 0.25d0))
+ (assert-eql 0.25541281188299536d0 (atanh x))
+ (assert-eql -0.25541281188299536d0 (atanh (- x)))
+ ;; There's no guarantee that atanh(1/4) = log(5/3)2 in floating
+ ;; point, but it's true in this case with fdlibm
+ (assert-eql (/ (log (float 5/3 1d0)) 2) (atanh x)))
+ ;; atanh(0.75) = log(7)/2, 0.5 < |x| < 1
+ (let ((x 0.75d0))
+ (assert-eql 0.9729550745276566d0 (atanh x))
+ (assert-eql -0.9729550745276566d0 (atanh (- x)))
+ ;; There's no guarantee that atanh(3/4) = log(7)2 in floating
+ ;; point, but it's true in this case with fdlibm
+ (assert-eql (/ (log 7d0) 2) (atanh x))))
+
\ No newline at end of file
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/commit/fab01803f386f8a7ce697ea58d26d07052297091
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cmucl-cvs/attachments/20151219/77d3daca/attachment.html>
More information about the cmucl-cvs
mailing list