COMPLEX-ATAN-BRANCH-CUTATAN results in a branch cut that is at variance with the recommendations of Prof. W. Kahan and with the implementations of that function in many computing systems and calculators.arctan z = - i log ((1+iz) sqrt (1/(1+z^2)))
with the formula
arctan z = (log (1+iz) - log (1-iz)) / (2i)
This leaves the branch cuts pretty much in place; the only change is that the upper branch cut (on the positive imaginary axis above i) is continuous with quadrant I, where the old formula has it continuous with quadrant II.
(atan #c(0 2)) => #c(-1.57... 0.549...) ;Current (atan #c(0 2)) => #c(1.57... -0.549...) ;Proposed
Note: 1.57... = pi/2, and 0.549... = (log 3)/2.
(atan #c(0 2)) => #c(-1.57... 0.549...) ;Symbolics CL (atan #c(0 2)) => #c(-1.57... 0.549...) ;Allegro CL 1.1 (Macintosh) (atan #c(0 2)) => #c(-1.57... 0.549...) ;Sun-4 CL 2.1.3 of 10-Nov-88 (atan #c(0 2)) => #c(1.57... -0.549...) ;Sun CL 2.0.3 of 30-Jun-87 (atan #c(0 2)) => #c(1.57... 0.549...) ;KCL of 3-Jun-87
Note that in KCL the upper branch cut is thus continuous with quadrant I, but its lower branch cut is continuous with quadrant III!
ATAN must be rewritten. It is not a very difficult fix.The compatibility note on p. 210 of CLtL gave users fair warning that a change of this kind might be adopted.
HP calculators.
Paul Penfield of MIT, after whose article the Common Lisp branch cuts were originally patterned, endorses this change.