[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))) ->

#C(1.0500000821378709167497674762372261576369237933558916554150445317294087
7702943L-9

9.9999999896666666683134966416887953589434016059498897741294881863894719391
568L-6)

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).

Ray






More information about the ecl-devel mailing list