Complex arg-trig functions

Stephen Montgomery-Smith stephen at missouri.edu
Sat Sep 22 21:12:41 UTC 2012


Here is a little cleaning in the code.

	/* To ensure the same accuracy as atan(), and to filter out z = 0. */
	if (x == 0)
		return (cpack(x, atan(y)));

	if (isnan(x) || isnan(y)) {
		/* catanh(+-Inf + I*NaN) = +-0 + I*NaN */
		if (isinf(x))
			return (cpack(copysign(0, x), y+y));
		/* catanh(NaN + I*+-Inf) = sign(NaN)0 + I*+-PI/2 */
		if (isinf(y))
			return (cpack(copysign(0, x), copysign(pio2_hi + pio2_lo, y)));
-		/* catanh(+-0 + I*NaN) = +-0 + I*NaN */
-		if (x == 0)
-			return (cpack(x, y+y));




More information about the freebsd-numerics mailing list