bug in (log)

James Cloos cloos at jhcloos.com
Sat Jul 2 18:43:05 UTC 2022


(gitlab is uusable; i have to report here.)

ecl 21.2.1 gives:

> (log 1/6319748715279270675921934218987893281199411530039296)

Debugger received error of type: DIVISION-BY-ZERO
#<a DIVISION-BY-ZERO 0x7ff5afe6c540>
Error flushed.

whereas other cl's (i testyed sbcl and ccl) give results like:

? (log 1/6319748715279270675921934218987893281199411530039296)
-119.27552

I tested on amd64 (gentoo) and arm64 (debian and netbsd) with identical
results.  i did not have a musl box or other bsd to test on.

run with --no-trap-fpe, the result is #<single-float negative infinity>.

another example is:

(truncate (log 1/6319748715279270675921934218987893281199418867))

Debugger received error of type: ARITHMETIC-ERROR
#<a ARITHMETIC-ERROR 0xffff8f688a40>

whereas this works:

(truncate (log 1/631974871527927067592193421898789328119941867))

-103
-0.27893066

which of course suggests that the issue is c's long double's precision.

it looks like ecl could use an mpq log function;
https://github.com/linas/anant might work.

-JimC
-- 
James Cloos <cloos at jhcloos.com>         OpenPGP: 0x997A9F17ED7DAEA6



More information about the ecl-devel mailing list