<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/71bdff741b398e37acbd13623ebb3a8142217c0a">71bdff74</a></strong>
<div>
<span>by Raymond Toy</span>
<i>at 2015-12-24T08:54:03Z</i>
</div>
<pre class='commit-message'>Use setexception to raise the inexact exception for sin.</pre>
</li>
<li>
<strong><a href="https://gitlab.common-lisp.net/cmucl/cmucl/commit/a31150c58c2727fcf802984b8306b849e6c5cba1">a31150c5</a></strong>
<div>
<span>by Raymond Toy</span>
<i>at 2015-12-24T08:59:29Z</i>
</div>
<pre class='commit-message'>Use setexception to raise the inexact exception for tan.</pre>
</li>
<li>
<strong><a href="https://gitlab.common-lisp.net/cmucl/cmucl/commit/ae70cdd320e8e0cae0abae3f5f7d593d2f9d7018">ae70cdd3</a></strong>
<div>
<span>by Raymond Toy</span>
<i>at 2015-12-24T09:06:54Z</i>
</div>
<pre class='commit-message'>Use setexception to raise the inexact exception for atan.</pre>
</li>
</ul>
<h4>4 changed files:</h4>
<ul>
<li class='file-stats'>
<a href='#diff-0'>
src/lisp/k_sin.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-1'>
src/lisp/k_tan.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-2'>
src/lisp/s_atan.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-3'>
tests/fdlibm.lisp
</a>
</li>
</ul>
<h4>Changes:</h4>
<li id='diff-0'>
<a href='https://gitlab.common-lisp.net/cmucl/cmucl/compare/d448ca78228ea8b9173a4b42d24d16c8e9a4ef55...ae70cdd320e8e0cae0abae3f5f7d593d2f9d7018#diff-0'>
<strong>
src/lisp/k_sin.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/lisp/k_sin.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/lisp/k_sin.c
</span><span style="color: #aaaaaa">@@ -67,8 +67,14 @@ S6 = 1.58969099521155010221e-10; /* 0x3DE5D93A, 0x5ACFD57C */
</span>
ux.d = x;
ix = ux.i[HIWORD]&0x7fffffff; /* high word of x */
<span style="color: #000000;background-color: #ffdddd">- if(ix<0x3e400000) /* |x| < 2**-27 */
- {if((int)x==0) return x;} /* generate inexact */
</span><span style="color: #000000;background-color: #ddffdd">+ if(ix<0x3e400000) { /* |x| < 2**-27 */
+ /* return x inexact except 0 */
+ if (x != 0) {
+ fdlibm_setexception(x, FDLIBM_INEXACT);
+ }
+
+ return x;
+ }
</span> z = x*x;
v = z*x;
r = S2+z*(S3+z*(S4+z*(S5+z*S6)));
</code></pre>
<br>
</li>
<li id='diff-1'>
<a href='https://gitlab.common-lisp.net/cmucl/cmucl/compare/d448ca78228ea8b9173a4b42d24d16c8e9a4ef55...ae70cdd320e8e0cae0abae3f5f7d593d2f9d7018#diff-1'>
<strong>
src/lisp/k_tan.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/lisp/k_tan.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/lisp/k_tan.c
</span><span style="color: #aaaaaa">@@ -78,31 +78,34 @@ __kernel_tan(double x, double y, int iy) {
</span> hx = ux.i[HIWORD]; /* high word of x */
ix = hx & 0x7fffffff; /* high word of |x| */
if (ix < 0x3e300000) { /* x < 2**-28 */
<span style="color: #000000;background-color: #ffdddd">- if ((int) x == 0) { /* generate inexact */
- if (((ix | ux.i[LOWORD]) | (iy + 1)) == 0)
- return one / fabs(x);
- else {
- if (iy == 1)
- return x;
- else { /* compute -1 / (x+y) carefully */
- double a, t;
</span><span style="color: #000000;background-color: #ddffdd">+ /* return x inexact except 0 */
+ if (x != 0) {
+ fdlibm_setexception(x, FDLIBM_INEXACT);
+ }
</span>
<span style="color: #000000;background-color: #ffdddd">- z = w = x + y;
- uz.d = z;
- uz.i[LOWORD] = 0;
- z = ux.d;
</span><span style="color: #000000;background-color: #ddffdd">+ if (((ix | ux.i[LOWORD]) | (iy + 1)) == 0)
+ return one / fabs(x);
+ else {
+ if (iy == 1)
+ return x;
+ else { /* compute -1 / (x+y) carefully */
+ double a, t;
+
+ z = w = x + y;
+ uz.d = z;
+ uz.i[LOWORD] = 0;
+ z = ux.d;
</span>
<span style="color: #000000;background-color: #ffdddd">- v = y - (z - x);
- t = a = -one / w;
- uz.d = t;
- uz.i[LOWORD] = 0;
- t = uz.d;
</span><span style="color: #000000;background-color: #ddffdd">+ v = y - (z - x);
+ t = a = -one / w;
+ uz.d = t;
+ uz.i[LOWORD] = 0;
+ t = uz.d;
</span>
<span style="color: #000000;background-color: #ffdddd">- s = one + t * z;
- return t + a * (s + t * v);
- }
- }
</span><span style="color: #000000;background-color: #ddffdd">+ s = one + t * z;
+ return t + a * (s + t * v);
</span> }
<span style="color: #000000;background-color: #ddffdd">+ }
</span> }
if (ix >= 0x3FE59428) { /* |x| >= 0.6744 */
if (hx < 0) {
</code></pre>
<br>
</li>
<li id='diff-2'>
<a href='https://gitlab.common-lisp.net/cmucl/cmucl/compare/d448ca78228ea8b9173a4b42d24d16c8e9a4ef55...ae70cdd320e8e0cae0abae3f5f7d593d2f9d7018#diff-2'>
<strong>
src/lisp/s_atan.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/lisp/s_atan.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/lisp/s_atan.c
</span><span style="color: #aaaaaa">@@ -104,7 +104,12 @@ huge = 1.0e300;
</span> else return -atanhi[3]-atanlo[3];
} if (ix < 0x3fdc0000) { /* |x| < 0.4375 */
if (ix < 0x3e200000) { /* |x| < 2^-29 */
<span style="color: #000000;background-color: #ffdddd">- if(huge+x>one) return x; /* raise inexact */
</span><span style="color: #000000;background-color: #ddffdd">+ /* return x inexact except 0 */
+ if (x != 0) {
+ fdlibm_setexception(x, FDLIBM_INEXACT);
+ }
+
+ return x;
</span> }
id = -1;
} else {
</code></pre>
<br>
</li>
<li id='diff-3'>
<a href='https://gitlab.common-lisp.net/cmucl/cmucl/compare/d448ca78228ea8b9173a4b42d24d16c8e9a4ef55...ae70cdd320e8e0cae0abae3f5f7d593d2f9d7018#diff-3'>
<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">@@ -258,7 +258,19 @@
</span> (kernel:%atan *snan*))
(assert-true (ext:float-nan-p (kernel:%atan *qnan*)))
(kernel::with-float-traps-masked (:invalid)
<span style="color: #000000;background-color: #ffdddd">- (assert-true (ext:float-nan-p (kernel:%atan *snan*)))))
</span><span style="color: #000000;background-color: #ddffdd">+ (assert-true (ext:float-nan-p (kernel:%atan *snan*))))
+ ;; atan(x) = x for |x| < 2^-29, signaling inexact.
+ (let ((x (scale-float 1d0 -30))
+ (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:%atan 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:%atan x)))))
</span>
(define-test %log10.exceptions
(:tag :fdlibm)
<span style="color: #aaaaaa">@@ -622,3 +634,34 @@
</span> ;; though the result is exactly x.
(assert-error 'floating-point-inexact
(kernel:%cos x)))))
<span style="color: #000000;background-color: #ddffdd">+
+(define-test %sin.exceptions
+ (:tag :fdlibm)
+ ;; sin(x) = x 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 0d0 (kernel:%sin 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:%sin x)))))
+
+(define-test %tan.exceptions
+ (:tag :fdlibm)
+ ;; tan(x) = x for |x| < 2^-28. 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:%tan 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:%tan 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/d448ca78228ea8b9173a4b42d24d16c8e9a4ef55...ae70cdd320e8e0cae0abae3f5f7d593d2f9d7018">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>