<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">All this is true, but it does not account for the anomaly. This appears to be a legitimate bug:<div><br></div><div><div>? (let ((a 4110710000054) (b 100000000000))</div><div> (list (float (/ a b)) (float (/ (+ a 1) b)) (float (/ (+ a 2) b))))</div><div>(41.1071 41.107098 41.1071)</div></div><div><div>? (mapcar 'decode-float *)</div><div>(0.64229846 0.6422984 0.64229846)</div><div><br></div><div>It is very data dependent, only manifesting itself for very particular values of A. I have not yet been able to discern any pattern, but here are a few interesting edge cases:</div><div><br></div><div><div>? (let ((a 7110710000054) (b 100000000000))</div><div> (list (float (/ a b)) (float (/ (+ a 1) b)) (float (/ (+ a 2) b))))</div><div>(71.1071 71.10709 71.1071)</div></div><div><br></div><div><div>? (let ((a 7110720000054) (b 100000000000))</div><div> (list (float (/ a b)) (float (/ (+ a 1) b)) (float (/ (+ a 2) b))))</div><div>(71.1072 71.1072 71.1072)</div></div><div><br></div><div><div>? (let ((a 4110709000054) (b 100000000000))</div><div> (list (float (/ a b)) (float (/ (+ a 1) b)) (float (/ (+ a 2) b))))</div><div>(41.10709 41.10709 41.10709)</div></div><div><br></div><div>AFAICT the bug is in ccl::%short-float-ratio. I’ll track it down when I have time, but with the above test cases it should not be too hard to figure it out.</div><div><br></div><div>rg</div><div><br></div><div><div>On Sep 19, 2021, at 10:56 PM, Raymond Wiker <<a href="mailto:rwiker@gmail.com">rwiker@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><meta http-equiv="Content-Type" content="text/html; charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">For IEEE-754 single-precision floating-point, the mantissa is held in 23 bits. log10 of 2^23 is about 6.9237, so you should expect less than 7 decimal digits of accuracy. 411071.0 is 7 digits, so anything after that can (and should) be ignored. The difference between 411071.0 and 411071.03 expressed as a float32 is a single bit: the least significant bit of the mantissa.<div class=""><br class=""></div><div class="">The reason that coerce gives a slightly worse result is that you compute the value as float32, then convert to float64, and when you print the number, more digits will be printed.</div><div class=""><br class=""></div><div class=""><div class=""><br class=""><blockquote type="cite" class=""><div class="">On 19 Sep 2021, at 15:05, Steven Nunez <<a href="mailto:steve_nunez@yahoo.com" class="">steve_nunez@yahoo.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class=""><div class="yahoo-style-wrap" style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:13px;"><div dir="ltr" data-setdir="false" class="">Hi folks,</div><div dir="ltr" data-setdir="false" class=""><br class=""></div><div dir="ltr" data-setdir="false" class="">I just posted an issue regarding what looks like a <a href="https://github.com/Clozure/ccl/issues/390" class="">bug in rational->float conversion</a>, and I'm hoping someone here can try this on 1.12 (preferably on MS Windows), or perhaps provide some insight as to what might be going on here for a quick fix.<br class=""></div><div class=""><br class=""></div><div dir="ltr" data-setdir="false" class=""><div class=""><font face=""courier new", courier, monaco, monospace, sans-serif" class="">CL-USER> (lisp-implementation-version)<br class="">"Version 1.11.8 (v1.11.8-2-gd411e378) WindowsX8664"<br class="">CL-USER> (float 41107100000541273/100000000000)<br class="">411071.03<br class=""><br class=""><font face=""Helvetica Neue", Helvetica, Arial, sans-serif" class="">Hmm. If you work out the decimal points, the float is: 411071.00000541273, that's a long way from .03. Maybe <font face=""courier new", courier, monaco, monospace, sans-serif" class="">coerce</font>? Nope, that's even worse:</font><br class=""><br class="">CL-USER> (coerce 41107100000541273/100000000000 'double-float)<br class="">411071.03125D0</font><br class=""><br class=""></div><div dir="ltr" data-setdir="false" class="">Any ideas? That's not a small rounding error.<br class=""></div><div dir="ltr" data-setdir="false" class=""><br class=""></div><div dir="ltr" data-setdir="false" class="">Regards,</div><div dir="ltr" data-setdir="false" class=""> Steve<br class=""></div></div></div></div>_______________________________________________<br class="">Openmcl-devel mailing list<br class=""><a href="mailto:Openmcl-devel@clozure.com" class="">Openmcl-devel@clozure.com</a><br class=""><a href="https://lists.clozure.com/mailman/listinfo/openmcl-devel" class="">https://lists.clozure.com/mailman/listinfo/openmcl-devel</a><br class=""></div></blockquote></div><br class=""></div></div></div>_______________________________________________<br>Openmcl-devel mailing list<br><a href="mailto:Openmcl-devel@clozure.com">Openmcl-devel@clozure.com</a><br>https://lists.clozure.com/mailman/listinfo/openmcl-devel<br></blockquote></div><br></div></body></html>