<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/b9e3a5113c1c08e5785fc36866a8e4553a96300e">b9e3a511</a></strong>
<div>
<span>by Raymond Toy</span>
<i>at 2015-12-24T09:29:08Z</i>
</div>
<pre class='commit-message'>Use setexception to raise the inexact exception for tanh.

Note that original code didn't actually signal inexact probably
because the compiler constant-folded one - tiny to one.</pre>
</li>
</ul>
<h4>2 changed files:</h4>
<ul>
<li class='file-stats'>
<a href='#diff-0'>
src/lisp/s_tanh.c
</a>
</li>
<li class='file-stats'>
<a href='#diff-1'>
tests/fdlibm.lisp
</a>
</li>
</ul>
<h4>Changes:</h4>
<li id='diff-0'>
<a href='https://gitlab.common-lisp.net/cmucl/cmucl/commit/b9e3a5113c1c08e5785fc36866a8e4553a96300e#diff-0'>
<strong>
src/lisp/s_tanh.c
</strong>
</a>
<hr>
<pre class="highlight"><code><span style="color: #000000;background-color: #ffdddd">--- a/src/lisp/s_tanh.c
</span><span style="color: #000000;background-color: #ddffdd">+++ b/src/lisp/s_tanh.c
</span><span style="color: #aaaaaa">@@ -78,7 +78,9 @@ static double one=1.0, two=2.0, tiny = 1.0e-300;
</span>       }
     /* |x| > 22, return +-1 */
        } else {
<span style="color: #000000;background-color: #ffdddd">-            z = one - tiny;             /* raised inexact flag */
</span><span style="color: #000000;background-color: #ddffdd">+       /* Always raise inexact flag */
+           fdlibm_setexception(x, FDLIBM_INEXACT);
+           z = one - tiny;
</span>   }
        return (jx>=0)? z: -z;
 }
</code></pre>

<br>
</li>
<li id='diff-1'>
<a href='https://gitlab.common-lisp.net/cmucl/cmucl/commit/b9e3a5113c1c08e5785fc36866a8e4553a96300e#diff-1'>
<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">@@ -88,7 +88,14 @@
</span>   (assert-error 'floating-point-invalid-operation
                (kernel:%tanh *snan*))
   (kernel::with-float-traps-masked (:invalid)
<span style="color: #000000;background-color: #ffdddd">-    (assert-true (ext:float-nan-p (kernel:%tanh *snan*)))))
</span><span style="color: #000000;background-color: #ddffdd">+    (assert-true (ext:float-nan-p (kernel:%tanh *snan*))))
+  ;; tanh(x) = +/- 1 for |x| > 22, raising inexact, always.
+  (let ((x 22.1d0))
+    (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:%tanh x)))))
</span> 
 (define-test %acosh.exceptions
   (:tag :fdlibm)
</code></pre>

<br>
</li>

</div>
<div class='footer' style='margin-top: 10px;'>
<p>

<br>
<a href="https://gitlab.common-lisp.net/cmucl/cmucl/commit/b9e3a5113c1c08e5785fc36866a8e4553a96300e">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.
<script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","action":{"@type":"ViewAction","name":"View Commit","url":"https://gitlab.common-lisp.net/cmucl/cmucl/commit/b9e3a5113c1c08e5785fc36866a8e4553a96300e"}}</script>
</p>
</div>
</body>
</html>