4 double log(), f__cabs(), atan2();
5 VOID
z_log(r
, z
) doublecomplex
*r
, *z
;
9 extern double f__cabs(double, double);
10 void z_log(doublecomplex
*r
, doublecomplex
*z
)
13 double s
, s0
, t
, t2
, u
, v
;
14 double zi
= z
->i
, zr
= z
->r
;
18 r
->r
= log( f__cabs( zr
, zi
) );
30 s
= zr
* sqrt(1 + t
*t
);
31 /* now s = f__cabs(zi,zr), and zr = |zr| >= |zi| = zi */
40 log(1+x
) = x
- x
^2/2 + x
^3/3 - x
^4/4 + - ...
42 = x(1 - x
/2 + x
^2/3 -+...)
44 [sqrt(y
^2 + z
^2) - 1] * [sqrt(y
^2 + z
^2) + 1] = y
^2 + z
^2 - 1, so
46 sqrt(y
^2 + z
^2) - 1 = (y
^2 + z
^2 - 1) / [sqrt(y
^2 + z
^2) + 1]
50 t
= ((zr
*zr
- 1.) + zi
*zi
) / (s
+ 1);