<html lang='en'>
<head>
<meta content='text/html; charset=utf-8' http-equiv='Content-Type'>
<title>
GitLab
</title>
</meta>
</head>
<style>
img {
max-width: 100%;
height: auto;
}
p.details {
font-style:italic;
color:#777
}
.footer p {
font-size:small;
color:#777
}
pre.commit-message {
white-space: pre-wrap;
}
.file-stats a {
text-decoration: none;
}
.file-stats .new-file {
color: #090;
}
.file-stats .deleted-file {
color: #B00;
}
</style>
<body>
<div class='content'>
<h3>Raymond Toy pushed to branch rtoy-setexception-inexact at <a href="https://gitlab.common-lisp.net/cmucl/cmucl">cmucl / cmucl</a></h3>
<h4>
Commits:
</h4>
<ul>
<li>
<strong><a href="https://gitlab.common-lisp.net/cmucl/cmucl/commit/e90e91d466888ae39d2b5e70841e1792dbb6dded">e90e91d4</a></strong>
<div>
<span>by Raymond Toy</span>
<i>at 2015-12-23T19:43:17Z</i>
</div>
<pre class='commit-message'>Use setexception to raise the inexact exception for sinh.</pre>
</li>
<li>
<strong><a href="https://gitlab.common-lisp.net/cmucl/cmucl/commit/d448ca78228ea8b9173a4b42d24d16c8e9a4ef55">d448ca78</a></strong>
<div>
<span>by Raymond Toy</span>
<i>at 2015-12-23T19:49:21Z</i>
</div>
<pre class='commit-message'>Use setexception to raise the inexact exception for cos.</pre>
</li>
</ul>
<h4>3 changed files:</h4>
<ul>
<li class='file-stats'>
<a href='#diff-0'>
src/lisp/e_sinh.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-1'>
src/lisp/k_cos.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-2'>
tests/fdlibm.lisp
</a>
</li>
</ul>
<h4>Changes:</h4>
<li id='diff-0'>
<a href='https://gitlab.common-lisp.net/cmucl/cmucl/compare/b4c91767d6281cb4a6f976cee84cf17e876ccc6b...d448ca78228ea8b9173a4b42d24d16c8e9a4ef55#diff-0'>
<strong>
src/lisp/e_sinh.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/lisp/e_sinh.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/lisp/e_sinh.c
</span><span style="color: #aaaaaa">@@ -67,8 +67,14 @@ static double one = 1.0, shuge = 1.0e307;
</span> if (jx<0) h = -h;
/* |x| in [0,22], return sign(x)*0.5*(E+E/(E+1))) */
if (ix < 0x40360000) { /* |x|<22 */
<span style="color: #000000;background-color: #ffdddd">- if (ix<0x3e300000) /* |x|<2**-28 */
- if(shuge+x>one) return x;/* sinh(tiny) = tiny with inexact */
</span><span style="color: #000000;background-color: #ddffdd">+ if (ix<0x3e300000) { /* |x|<2**-28 */
+ /* sinh(tiny) = tiny with inexact */
+ if (x != 0) {
+ fdlibm_setexception(x, FDLIBM_INEXACT);
+ }
+
+ return x;
+ }
</span> t = fdlibm_expm1(fabs(x));
if(ix<0x3ff00000) return h*(2.0*t-t*t/(t+one));
return h*(t+t/(t+one));
</code></pre>
<br>
</li>
<li id='diff-1'>
<a href='https://gitlab.common-lisp.net/cmucl/cmucl/compare/b4c91767d6281cb4a6f976cee84cf17e876ccc6b...d448ca78228ea8b9173a4b42d24d16c8e9a4ef55#diff-1'>
<strong>
src/lisp/k_cos.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/lisp/k_cos.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/lisp/k_cos.c
</span><span style="color: #aaaaaa">@@ -75,7 +75,12 @@ C6 = -1.13596475577881948265e-11; /* 0xBDA8FAE9, 0xBE8838D4 */
</span> ux.d = x;
ix = ux.i[HIWORD]&0x7fffffff; /* ix = |x|'s high word*/
if(ix<0x3e400000) { /* if x < 2**27 */
<span style="color: #000000;background-color: #ffdddd">- if(((int)x)==0) return one; /* generate inexact */
</span><span style="color: #000000;background-color: #ddffdd">+ /* return 1 with inexact unless x == 0 */
+ if (x != 0) {
+ fdlibm_setexception(x, FDLIBM_INEXACT);
+ }
+
+ return one;
</span> }
z = x*x;
r = z*(C1+z*(C2+z*(C3+z*(C4+z*(C5+z*C6)))));
</code></pre>
<br>
</li>
<li id='diff-2'>
<a href='https://gitlab.common-lisp.net/cmucl/cmucl/compare/b4c91767d6281cb4a6f976cee84cf17e876ccc6b...d448ca78228ea8b9173a4b42d24d16c8e9a4ef55#diff-2'>
<strong>
tests/fdlibm.lisp
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/tests/fdlibm.lisp
</span><span style="color: #000000;background-color: #ddffdd">+++ b/tests/fdlibm.lisp
</span><span style="color: #aaaaaa">@@ -68,8 +68,19 @@
</span> (kernel:%sinh ext:double-float-negative-infinity)))
;; Test NaN
(kernel::with-float-traps-masked (:invalid)
<span style="color: #000000;background-color: #ffdddd">- (assert-true (ext:float-nan-p (kernel:%sinh *qnan*)))))
-
</span><span style="color: #000000;background-color: #ddffdd">+ (assert-true (ext:float-nan-p (kernel:%sinh *qnan*))))
+ ;; sinh(x) = x for |x| < 2^-28. Should signal inexact unless x = 0.
+ (let ((x (scale-float 1d0 -29))
+ (x0 0d0))
+ (with-inexact-exception-enabled
+ ;; This must not throw an inexact exception because the result
+ ;; is exact when the arg is 0.
+ (assert-eql 0d0 (kernel:%sinh x0)))
+ (with-inexact-exception-enabled
+ ;; This must throw an inexact exception for non-zero x even
+ ;; though the result is exactly x.
+ (assert-error 'floating-point-inexact
+ (kernel:%sinh x)))))
</span>
(define-test %tanh.exceptions
(:tag :fdlibm)
<span style="color: #aaaaaa">@@ -597,3 +608,17 @@
</span> (assert-error 'floating-point-inexact
(kernel:%asin x)))))
<span style="color: #000000;background-color: #ddffdd">+(define-test %cos.exceptions
+ (:tag :fdlibm)
+ ;; cos(x) = 1 for |x| < 2^-27. Signal inexact unless x = 0
+ (let ((x (scale-float 1d0 -28))
+ (x0 0d0))
+ (with-inexact-exception-enabled
+ ;; This must not throw an inexact exception because the result
+ ;; is exact when the arg is 0.
+ (assert-eql 1d0 (kernel:%cos x0)))
+ (with-inexact-exception-enabled
+ ;; This must throw an inexact exception for non-zero x even
+ ;; though the result is exactly x.
+ (assert-error 'floating-point-inexact
+ (kernel:%cos x)))))
</span></code></pre>
<br>
</li>
</div>
<div class='footer' style='margin-top: 10px;'>
<p>
—
<br>
<a href="https://gitlab.common-lisp.net/cmucl/cmucl/compare/b4c91767d6281cb4a6f976cee84cf17e876ccc6b...d448ca78228ea8b9173a4b42d24d16c8e9a4ef55">View it on GitLab</a>.
<br>
You're receiving this email because of your account on gitlab.common-lisp.net.
If you'd like to receive fewer emails, you can adjust your notification settings.
</p>
</div>
</body>
</html>