[Ecls-list] log(complex) inaccurate for some values

Raymond Toy toy.raymond at gmail.com
Fri Apr 11 01:59:39 UTC 2008

I reported this bug with clisp, but ecl has the same issue:

(log #c(1.000000001d0 1d-5)) -> 

#C(1.0500000857748893d-9 9.999999989666666d-6)

But with clisp's long-float, the true answer is closer to:

(setf (long-float-digits) 256)

(log (coerce #c(1.000000001d0 1d-5) '(complex long-float))) ->



CMUCL returns #C(1.0500000821378709d-9 9.999999989666666d-6)

I'm guessing here, but I suspect ecl is computing the real part as 
log(sqrt(x^2+y^2)).  This loses accuracy if x is near 1 and y is small 
(or vice versa).


More information about the ecl-devel mailing list