bug in (log)
Raymond Toy
toy.raymond at gmail.com
Sun Jul 3 16:05:32 UTC 2022
On Sun, Jul 3, 2022 at 8:10 AM James Cloos <cloos at jhcloos.com> wrote:
> it looks like that bug only harms ratio. bignum integer seems to be ok.
>
> so aworkarount is, in the caseof a ratio, to take the difference of the
> logs of the numerator and the denominator.
>
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.
>
> -JimC
> --
> James Cloos <cloos at jhcloos.com> OpenPGP: 0x997A9F17ED7DAEA6
>
>
--
Ray
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20220703/927d74da/attachment.html>
More information about the ecl-devel
mailing list