[git] CMU Common Lisp branch master updated. snapshot-2014-08-9-g375ce21

Raymond Toy rtoy at common-lisp.net
Fri Aug 15 04:06:30 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  375ce218ab639fbc0b433942dbb7398a0bcd0177 (commit)
      from  e585e8d6acbc146e978d1c2c5171987b6ba2fddf (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 375ce218ab639fbc0b433942dbb7398a0bcd0177
Author: Raymond Toy <toy.raymond at gmail.com>
Date:   Thu Aug 14 21:06:20 2014 -0700

    Fix ticket:106 by returning the correctly rounded value.
    
     * src/lisp/e_exp.c:
       * Add special case to return the correctly rounded value of exp(1).
     * tests/trac.lisp:
       * Add test that the correct value is returned.
       * Add test that exp(x) is still monotonic around x = 1.
     * src/general-info/release-20f.txt:
       * Update.

diff --git a/src/general-info/release-20f.txt b/src/general-info/release-20f.txt
index 265b0b5..92df6fa 100644
--- a/src/general-info/release-20f.txt
+++ b/src/general-info/release-20f.txt
@@ -97,6 +97,8 @@ New in this release:
     * In some situations KERNEL:DOUBLE-FLOAT-BITS on x86 would cause a
       segfault. This has been fixed.
     * For linux, motifd is no longer a 64-bit app.
+    * (exp 1d0) now returns the correctly rounded value of
+      e. Previously, it was off by one bit.
 
   * Trac Tickets:
     * Ticket #90 fixed.
@@ -111,6 +113,7 @@ New in this release:
     * Ticket #84 fixed on x86.
     * Ticket #105 fixed.
     * Ticket #101 fixed.
+    * Ticket #106 fixed.
 
   * Other changes:
 
diff --git a/src/lisp/e_exp.c b/src/lisp/e_exp.c
index 8233bc3..8b7ff6d 100644
--- a/src/lisp/e_exp.c
+++ b/src/lisp/e_exp.c
@@ -111,6 +111,17 @@ P5   =  4.13813679705723846039e-08; /* 0x3E663769, 0x72BEA4D0 */
 	unsigned hx;
 	union { int i[2]; double d; } ux;
 
+        /*
+         * CMUCL addition: Return correctly rounded value for
+         * exp(1). There are tests to verify that exp(x) is still
+         * monotonic around exp(1), so this change doens't break
+         * anything.
+         */
+        if (x == 1) {
+            /* Return the correctly rounded value for x = 1 */
+            return 2.718281828459045;
+        }
+
 	ux.d = x;
 	hx  = ux.i[HIWORD];	/* high word of x */
 	xsb = (hx>>31)&1;		/* sign bit of x */
diff --git a/tests/trac.lisp b/tests/trac.lisp
index 8253bc2..2bf420d 100644
--- a/tests/trac.lisp
+++ b/tests/trac.lisp
@@ -425,4 +425,14 @@ No dispatch function defined for #\\W.")
 		(read-string-fn "#\wtf")))
 			   
 
-  
\ No newline at end of file
+(define-test trac.106
+  (:tag :trac)
+  ;; Verify the value is correct
+  (assert-equal 2.718281828459045d0
+		(exp 1d0))
+  ;; Verify that exp is still monotonic around 1
+  (assert-true (<= (exp (1- double-float-negative-epsilon))
+		   (exp 1d0)
+		   (exp (1+ double-float-epsilon)))))
+
+

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

Summary of changes:
 src/general-info/release-20f.txt |    3 +++
 src/lisp/e_exp.c                 |   11 +++++++++++
 tests/trac.lisp                  |   12 +++++++++++-
 3 files changed, 25 insertions(+), 1 deletion(-)


hooks/post-receive
-- 
CMU Common Lisp



More information about the cmucl-cvs mailing list