[git] CMU Common Lisp branch master updated. snapshot-2014-08-27-gbd30c83
Raymond Toy
rtoy at common-lisp.net
Sat Aug 23 03:44:38 UTC 2014
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMU Common Lisp".
The branch, master has been updated
via bd30c83c9503bf6b5cb3f569e9b842e72772ae9b (commit)
via bd7a64136b73af04678f5116a07a3aed1d84b29b (commit)
from 2aa84447c6a2f5cee471d150a354226d0842fb69 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit bd30c83c9503bf6b5cb3f569e9b842e72772ae9b
Author: Raymond Toy <toy.raymond at gmail.com>
Date: Fri Aug 22 20:44:31 2014 -0700
Make asinh signal errors using fdlibm_setexception.
* src/lisp/s_asinh.c
* Use fdlibm_setexception
* tests/trig.lisp:
* Add tests for asinh
diff --git a/src/lisp/s_asinh.c b/src/lisp/s_asinh.c
index 6cae81f..dc99e5b 100644
--- a/src/lisp/s_asinh.c
+++ b/src/lisp/s_asinh.c
@@ -22,6 +22,8 @@
* := sign(x)*log1p(|x| + x^2/(1 + sqrt(1+x^2)))
*/
+#include <math.h>
+
#include "fdlibm.h"
#ifdef __STDC__
@@ -47,7 +49,15 @@ huge= 1.00000000000000000000e+300;
ux.d = x;
hx = ux.i[HIWORD];
ix = hx&0x7fffffff;
- if(ix>=0x7ff00000) return x+x; /* x is inf or NaN */
+ if(ix>=0x7ff00000) {
+ /* x is inf or NaN */
+ if (isnan(x)) {
+ return fdlibm_setexception(x, FDLIBM_INVALID);
+ } else {
+ return fdlibm_setexception(x, FDLIBM_OVERFLOW);
+ }
+ }
+
if(ix< 0x3e300000) { /* |x|<2**-28 */
if(huge+x>one) return x; /* return x inexact except 0 */
}
diff --git a/tests/trig.lisp b/tests/trig.lisp
index b4163b7..d95db71 100644
--- a/tests/trig.lisp
+++ b/tests/trig.lisp
@@ -870,7 +870,24 @@
(kernel:%acosh ext:double-float-positive-infinity)))
(kernel::with-float-traps-masked (:invalid)
(assert-true (ext:float-nan-p (kernel:%acosh 0d0)))))
-
+
+(define-test asinh.exceptions
+ (:tag :fdlibm)
+ (assert-error 'floating-point-invalid-operation
+ (kernel:%asinh *snan*))
+ (assert-error 'floating-point-overflow
+ (kernel:%asinh ext:double-float-positive-infinity))
+ (assert-error 'floating-point-overflow
+ (kernel:%asinh ext:double-float-negative-infinity))
+ (assert-true (ext:float-nan-p (kernel:%asinh *qnan*)))
+ (kernel::with-float-traps-masked (:overflow)
+ (assert-equal ext:double-float-positive-infinity
+ (kernel:%asinh ext:double-float-positive-infinity))
+ (assert-error ext:double-float-negative-infinity
+ (kernel:%asinh ext:double-float-negative-infinity)))
+ (kernel::with-float-traps-masked (:invalid)
+ (assert-true (ext:float-nan-p (kernel:%asinh *snan*)))))
+
(define-test expm1.exceptions
(:tag :fdlibm)
(assert-error 'floating-point-overflow
commit bd7a64136b73af04678f5116a07a3aed1d84b29b
Author: Raymond Toy <toy.raymond at gmail.com>
Date: Fri Aug 22 20:34:43 2014 -0700
Fix typo.
diff --git a/src/code/float-trap.lisp b/src/code/float-trap.lisp
index db0a9c4..a736e0d 100644
--- a/src/code/float-trap.lisp
+++ b/src/code/float-trap.lisp
@@ -121,7 +121,7 @@
new-mode)
)
-#(and sse2 darwin)
+#+(and sse2 darwin)
(progn
(defun floating-point-modes ()
;; Get just the SSE2 mode bits.
-----------------------------------------------------------------------
Summary of changes:
src/code/float-trap.lisp | 2 +-
src/lisp/s_asinh.c | 12 +++++++++++-
tests/trig.lisp | 19 ++++++++++++++++++-
3 files changed, 30 insertions(+), 3 deletions(-)
hooks/post-receive
--
CMU Common Lisp
More information about the cmucl-cvs
mailing list