From fab01803f386f8a7ce697ea58d26d07052297091 Mon Sep 17 00:00:00 2001
From: Raymond Toy <toy.raymond@gmail.com>
Date: Sat, 19 Dec 2015 09:46:21 -0800
Subject: [PATCH] Add atanh tests.

---
 tests/fdlibm.lisp | 26 +++++++++++++++++++++++---
 1 file changed, 23 insertions(+), 3 deletions(-)

diff --git a/tests/fdlibm.lisp b/tests/fdlibm.lisp
index f8a4fd897..8db07d41f 100644
--- 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
-- 
GitLab