[git] CMU Common Lisp branch master updated. snapshot-2014-02-4-g8970ad1

Raymond Toy rtoy at common-lisp.net
Sun Feb 9 17:53:21 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  8970ad11b03f863b40a9ee352d3aced52b783cce (commit)
      from  1554c686c73c29228bf5b77425837fe27f3aa201 (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 8970ad11b03f863b40a9ee352d3aced52b783cce
Author: Raymond Toy <toy.raymond at gmail.com>
Date:   Sun Feb 9 09:53:11 2014 -0800

    Fix ticket:92
    
    Type derivation for log fixed to be consistent with the actual
    returned values.
    
     * src/compiler/float-tran.lisp:
       * Update {{{LOG-DERIVE-TYPE-AUX-1}}} to compute the correct type.
    
     * tests/trac.lisp:
       * Add test for trac ticket:92

diff --git a/src/compiler/float-tran.lisp b/src/compiler/float-tran.lisp
index 08ce90b..b856a6c 100644
--- a/src/compiler/float-tran.lisp
+++ b/src/compiler/float-tran.lisp
@@ -1494,11 +1494,15 @@
   (two-arg-derive-type x y #'expt-derive-type-aux #'expt))
 
 
-;;; Note must assume that a type including 0.0 may also include -0.0
-;;; and thus the result may be complex -infinity + i*pi.
-;;;
 (defun log-derive-type-aux-1 (x)
-  (elfun-derive-type-simple x #'log 0d0 nil nil nil))
+  (elfun-derive-type-simple x
+			    #'(lambda (z)
+				;; log(0) and log(-0) is -infinity.
+				;; Return NIL to indicate that.
+				(if (zerop z)
+				    nil
+				    (log z)))
+			    -0d0 nil nil nil))
 
 (defun log-derive-type-aux-2 (x y same-arg)
   (let ((log-x (log-derive-type-aux-1 x))
diff --git a/tests/trac.lisp b/tests/trac.lisp
index 3e23d3e..dfbbf8b 100644
--- a/tests/trac.lisp
+++ b/tests/trac.lisp
@@ -273,3 +273,13 @@
   ;; The following formats should not signal an error.
   (assert-true (ignore-errors (format nil "~ve" 21 5d-234)))
   (assert-true (ignore-errors (format nil "~ve" 100 5d-234))))
+
+(define-test trac.92
+  (:tag :trac)
+  (let ((f (compile nil
+		    #'(lambda (x)
+			(declare (type (double-float 0d0) x))
+			(log x)))))
+    (assert-equal
+     'double-float
+     (third (kernel:%function-type f)))))

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

Summary of changes:
 src/compiler/float-tran.lisp |   12 ++++++++----
 tests/trac.lisp              |   10 ++++++++++
 2 files changed, 18 insertions(+), 4 deletions(-)


hooks/post-receive
-- 
CMU Common Lisp



More information about the cmucl-cvs mailing list