| Contributed by Danny Smith
|
| FIXME: This needs some serious numerical analysis.
|
| /* catan (z) = -I/2 * clog ((I + z) / (I - z)) */
|
| #define _M_PI_2L 1.5707963267948966192313L
|
| catanl (long double complex Z)
|
| long double x = __real__ Z;
|
| long double y = __imag__ Z;
|
| if ( x == 0.0L && (1.0L - fabsl (y)) == 0.0L)
|
| __real__ Res = HUGE_VALL;
|
| __imag__ Res = HUGE_VALL;
|
| else if (isinf (hypotl (x, y)))
|
| __real__ Res = (x > 0 ? _M_PI_2L : -_M_PI_2L);
|
| __real__ Res = - 0.5L * __imag__ Tmp;
|
| __imag__ Res = 0.5L * __real__ Tmp;
|