Clozure CL: Ticket #869: atan/log/sqrt failures
http://trac.clozure.com/ccl/ticket/869
<p>
The sqrt, log and atan functions are failing over significant portions of their domain (particularly for rational or complex rational arguments), even when it is entirely reasonable that a good result should be returned. Some typical examples are:
</p>
<pre class="wiki">(sqrt (expt 10 47)) => 3.1622778E+23 ;CCL errors
(sqrt (/ (expt 10 47) 3)) => 1.8257418E+23 ;CCL errors
(sqrt (complex (expt 10 46) (expt 10 47))) => #C(2.3505187E+23 2.12719E+23) ;CCL errors
(sqrt (complex most-positive-short-float most-positive-short-float)) => #C(2.0267142E+19 8.394926E+18) ;CCL errors
(log (expt 10 -66)) => -151.97063 ;CCL errors
(log (- (expt 10 66))) => #C(151.97063 3.1415927) ;CCL returns wrong type (double, not single)
(log (complex (expt 10 65) (expt 10 66))) => #C(151.9756 1.4711276) ;CCL errors
(log (complex (expt 10 -65) (expt 10 -66))) => #C(-149.66307 0.09966865) ;CCL errors
(log 8.0d0 2) => 3.0D0 ;CCL returns wildly inaccurate result
(log #C(0.0 1.0) 0) => #C(0.0 0.0) ;CCL returns wrong type (integer)
(atan (expt 10 46) (expt 10 47)) => 0.09966865 ;CCL errors
(atan (expt 10 -46) (expt 10 -47)) => 1.4711276 ;CCL returns zero
</pre><p>
I'm attaching a file that demonstrates how these could all be fixed by making changes to CCL's sqrt, log, log-e and atan functions (but the changes may not be implemented in the most efficient way). Making these fixes would also have a knock-on effect and correct dependent infelicities in both the arg and phase functions (which aren't noted above).
</p>
en-usClozure CLhttp://trac.clozure.com/ccl/chrome/site/logo.png
http://trac.clozure.com/ccl/ticket/869
Trac 0.12.2dfindlayThu, 16 Jun 2011 13:28:45 GMTattachment set
http://trac.clozure.com/ccl/ticket/869
http://trac.clozure.com/ccl/ticket/869
<ul>
<li><strong>attachment</strong>
set to <em>fn-ticket.lisp</em>
</li>
</ul>
<p>
sqrt/log/atan changes [demo]
</p>
TicketrmeMon, 27 Jun 2011 15:16:59 GMTowner set
http://trac.clozure.com/ccl/ticket/869#comment:1
http://trac.clozure.com/ccl/ticket/869#comment:1
<ul>
<li><strong>owner</strong>
set to <em>rme</em>
</li>
</ul>
TicketrmeTue, 09 Aug 2011 01:39:11 GMTmilestone set
http://trac.clozure.com/ccl/ticket/869#comment:2
http://trac.clozure.com/ccl/ticket/869#comment:2
<ul>
<li><strong>milestone</strong>
set to <em>Clozure CL 1.8</em>
</li>
</ul>
TicketdfindlayMon, 12 Sep 2011 12:43:45 GMT
http://trac.clozure.com/ccl/ticket/869#comment:3
http://trac.clozure.com/ccl/ticket/869#comment:3
<p>
I've tried (but possibly not completely succeeded) to come up with some sort of "reference" implementation for CL's math functions. Of course, the problems originally mentioned are fixed (and there aren't some of the obvious bugs in the previous attachment - sorry), and a few other problems are identified.
</p>
<p>
You could you this in two ways. Either you could use it to test an upgraded CCL implementation. Or you could just use the implementation as CCL's.
</p>
<p>
Just loading the attached file will give some key comparison's between the "reference" implementation and CCL's.
</p>
TicketdfindlayMon, 12 Sep 2011 12:45:15 GMTattachment set
http://trac.clozure.com/ccl/ticket/869
http://trac.clozure.com/ccl/ticket/869
<ul>
<li><strong>attachment</strong>
set to <em>ccl-math-reference.lisp</em>
</li>
</ul>
<p>
"Reference" implementation of math functions
</p>
TicketgbTue, 29 Jan 2013 19:35:02 GMTowner, status changed
http://trac.clozure.com/ccl/ticket/869#comment:4
http://trac.clozure.com/ccl/ticket/869#comment:4
<ul>
<li><strong>owner</strong>
changed from <em>rme</em> to <em>gb</em>
</li>
<li><strong>status</strong>
changed from <em>new</em> to <em>assigned</em>
</li>
</ul>
TicketgbMon, 04 Feb 2013 18:39:53 GMTstatus changed; resolution set
http://trac.clozure.com/ccl/ticket/869#comment:5
http://trac.clozure.com/ccl/ticket/869#comment:5
<ul>
<li><strong>status</strong>
changed from <em>assigned</em> to <em>closed</em>
</li>
<li><strong>resolution</strong>
set to <em>fixed</em>
</li>
</ul>
<p>
(In <a class="changeset" href="http://trac.clozure.com/ccl/changeset/15683" title="Implement the rest of Dave Findlay's "reference" math library.
Fixes ...">[15683]</a>) Implement the rest of Dave Findlay's "reference" math library.
Fixes <a class="closed ticket" href="http://trac.clozure.com/ccl/ticket/869" title="defect: atan/log/sqrt failures (closed: fixed)">ticket:869</a> in the trunk.
</p>
Ticket