[Git][cmucl/cmucl][master] Add tests for asinh, taken from fdlibm-js.

Raymond Toy rtoy at common-lisp.net
Sat Dec 19 17:32:52 UTC 2015


Raymond Toy pushed to branch master at cmucl / cmucl


Commits:
1d604dc6 by Raymond Toy at 2015-12-19T09:32:37Z
Add tests for asinh, taken from fdlibm-js.

- - - - -


1 changed file:

- tests/fdlibm.lisp


Changes:

=====================================
tests/fdlibm.lisp
=====================================
--- a/tests/fdlibm.lisp
+++ b/tests/fdlibm.lisp
@@ -266,3 +266,37 @@
 		  (kernel:%scalbn most-positive-double-float 2))
     (assert-equal ext:double-float-negative-infinity
 		  (kernel:%scalbn most-negative-double-float 2))))
+

+;;; These tests taken from github.com/rtoy/fdlibm-js
+(define-test asinh-basic-tests
+    (:tag :fdlibm)
+  (assert-eql -0d0 (asinh -0d0))
+  (assert-eql 0d0 (asinh 0d0))
+  (let ((x (scale-float 1d0 -29)))
+    ;; asinh(x) = x for x < 2^-28
+    (assert-eql x (asinh x))
+    (assert-eql (- x) (asinh (- x))))
+  (let ((x (scale-float 1d0 -28)))
+    ;; Case 2 > |x| >= 2^-28
+    (assert-eql 3.725290298461914d-9 (asinh x))
+    (assert-eql -3.725290298461914d-9 (asinh (- x))))
+  (let ((x 1d0))
+    ;; Case 2 > |x| >= 2^-28
+    (assert-eql 0.881373587019543d0 (asinh x))
+    (assert-eql -0.881373587019543d0 (asinh (- x))))
+  (let ((x 5d0))
+    ;; Case 2^28 > |x| > 2
+    (assert-eql 2.3124383412727525d0 (asinh x))
+    (assert-eql -2.3124383412727525d0 (asinh (- x))))
+  (let ((x (scale-float 1d0 28)))
+    ;; Case 2^28 > |x|
+    (assert-eql 20.101268236238415d0 (asinh x))
+    (assert-eql -20.101268236238415d0 (asinh (- x))))
+  (let ((x most-positive-double-float))
+    ;; No overflow for most-positive-double-float
+    (assert-eql 710.4758600739439d0 (asinh x))
+    (assert-eql -710.4758600739439d0 (asinh (- x)))))
+  
+    
+  
+  
\ No newline at end of file



View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/commit/1d604dc615d00763f303fb035eb8d64e987fc69c
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cmucl-cvs/attachments/20151219/80125a69/attachment.html>


More information about the cmucl-cvs mailing list