<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Jul 3, 2022 at 8:10 AM James Cloos <<a href="mailto:cloos@jhcloos.com">cloos@jhcloos.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">it looks like that bug only harms ratio.  bignum integer seems to be ok.<br>
<br>
so aworkarount is, in the caseof a ratio, to take the difference of the<br>
logs of the numerator and the denominator.<br></blockquote><div><br></div><div style="font-family:arial,helvetica,sans-serif;font-size:small" class="gmail_default">This is basically what cmucl does.  But you have to be careful if the numerator and denominator are very close to each other.  Then you'll take the difference of two logs that are essentially equal and lose lots or precision.  IIRC, cmucl doesn't do this if the ratio is close to 1 because then converting to double-float isn't a problem.  There are other ways to handle this though, like implementing a log2 function that returns the integer part and the fraction separately so you don't lose too many fraction bits when the numbers are huge.<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
-JimC<br>
-- <br>
James Cloos <<a href="mailto:cloos@jhcloos.com" target="_blank">cloos@jhcloos.com</a>>         OpenPGP: 0x997A9F17ED7DAEA6<br>
<br>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div></div>Ray<br></div></div></div>