[cmucl-commit] [git] CMU Common Lisp branch master updated. snapshot-2014-03-3-g179e05d

Raymond Toy rtoy at common-lisp.net
Sat Mar 8 21:32:14 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  179e05df049f705f95eea224d1248ba5e979ce18 (commit)
      from  f15327ba2aba87dea3c67204ca0f1100c1a605d9 (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 179e05df049f705f95eea224d1248ba5e979ce18
Author: Raymond Toy <toy.raymond at gmail.com>
Date:   Sat Mar 8 13:32:08 2014 -0800

    Return the correct values for (log -0w0) and (log 0w0).  Previously we
    returned something like #c(-715 pi) and -715.
    
     * src/code/irrat-dd.lisp:
       * Handle -0w0 and 0w0 specially in dd-%log.
    
     * tests/trac.lisp:
       * Add a test for this in trac.lisp.

diff --git a/src/code/irrat-dd.lisp b/src/code/irrat-dd.lisp
index 29627b5..438339f 100644
--- a/src/code/irrat-dd.lisp
+++ b/src/code/irrat-dd.lisp
@@ -368,10 +368,17 @@
 	     (optimize (speed 3) (space 0)
 		       (inhibit-warnings 3)))
     ;; Separate mantissa from exponent
-    (multiple-value-bind (x e)
+    (multiple-value-bind (x e sign)
 	(decode-float x)
       (declare (type double-double-float x)
 	       (type double-float-exponent e))
+      (when (zerop x)
+	;; Handle log(+/-0).  Return -inf or -inf + i*pi, but signal a
+	;; division by zero.
+	(return-from dd-%log
+	  (if (minusp sign)
+	      (complex (/ (- x)) dd-pi)
+	      (/ (- x)))))
       (let ((z 0w0)
 	    (y 0w0))
 	(declare (type double-double-float z y))
diff --git a/tests/trac.lisp b/tests/trac.lisp
index f8b4258..9a02189 100644
--- a/tests/trac.lisp
+++ b/tests/trac.lisp
@@ -342,7 +342,10 @@
      (ext:with-float-traps-masked (:divide-by-zero) (log -0d0)))
     (assert-equal
      (complex ext:single-float-negative-infinity (float pi 1f0))
-     (ext:with-float-traps-masked (:divide-by-zero) (log -0f0)))))
+     (ext:with-float-traps-masked (:divide-by-zero) (log -0f0)))
+    (assert-equal
+     (complex ext:double-double-float-negative-infinity kernel:dd-pi)
+     (ext:with-float-traps-masked (:divide-by-zero) (log -0w0)))))
 
 (define-test trac.93
   (:tag :trac)

-----------------------------------------------------------------------

Summary of changes:
 src/code/irrat-dd.lisp |    9 ++++++++-
 tests/trac.lisp        |    5 ++++-
 2 files changed, 12 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
CMU Common Lisp


More information about the cmucl-commit mailing list