Skip to content
Snippets Groups Projects
Commit 375ce218 authored by Raymond Toy's avatar Raymond Toy
Browse files

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.
parent e585e8d6
No related branches found
No related tags found
No related merge requests found
...@@ -97,6 +97,8 @@ New in this release: ...@@ -97,6 +97,8 @@ New in this release:
* In some situations KERNEL:DOUBLE-FLOAT-BITS on x86 would cause a * In some situations KERNEL:DOUBLE-FLOAT-BITS on x86 would cause a
segfault. This has been fixed. segfault. This has been fixed.
* For linux, motifd is no longer a 64-bit app. * 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: * Trac Tickets:
* Ticket #90 fixed. * Ticket #90 fixed.
...@@ -111,6 +113,7 @@ New in this release: ...@@ -111,6 +113,7 @@ New in this release:
* Ticket #84 fixed on x86. * Ticket #84 fixed on x86.
* Ticket #105 fixed. * Ticket #105 fixed.
* Ticket #101 fixed. * Ticket #101 fixed.
* Ticket #106 fixed.
* Other changes: * Other changes:
......
...@@ -111,6 +111,17 @@ P5 = 4.13813679705723846039e-08; /* 0x3E663769, 0x72BEA4D0 */ ...@@ -111,6 +111,17 @@ P5 = 4.13813679705723846039e-08; /* 0x3E663769, 0x72BEA4D0 */
unsigned hx; unsigned hx;
union { int i[2]; double d; } ux; 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; ux.d = x;
hx = ux.i[HIWORD]; /* high word of x */ hx = ux.i[HIWORD]; /* high word of x */
xsb = (hx>>31)&1; /* sign bit of x */ xsb = (hx>>31)&1; /* sign bit of x */
......
...@@ -425,4 +425,14 @@ No dispatch function defined for #\\W.") ...@@ -425,4 +425,14 @@ No dispatch function defined for #\\W.")
(read-string-fn "#\wtf"))) (read-string-fn "#\wtf")))
(define-test trac.106
\ No newline at end of file (: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)))))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment