Changeset 14669


Ignore:
Timestamp:
Mar 7, 2011, 9:39:28 PM (9 years ago)
Author:
rme
Message:

In ATAN of a complex argument, compute the value in terms of the
formula for ATANH, that is, use the formula:

atan(z) = atanh(iz)/i = -i atanh(iz).

Fixes ticket:828, and with any luck, won't screw up anything else.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/level-0/l0-float.lisp

    r14365 r14669  
    746746      (%sf-atan2 (%short-float y) (%short-float x)))
    747747    (if (typep y 'complex)
    748       (let* ((iy (* (sqrt -1) y)))
    749              (/ (- (log (+ 1 iy)) (log (- 1 iy)))
    750                 #c(0 2)))
     748      ;; atan y = atanh(i*y)/i = -i atanh(i*y)
     749      (let* ((iy (complex (- (imagpart y)) (realpart y)))
     750             (h (/ (- (log (+ 1 iy)) (log (- 1 iy))) 2))) ;(atanh iy)
     751        (complex (imagpart h) (- (realpart h))))
    751752      (if (typep y 'double-float)
    752753        (%double-float-atan! y (%make-dfloat))
Note: See TracChangeset for help on using the changeset viewer.