Complex arg-trig functions

Stephen Montgomery-Smith stephen at missouri.edu
Sun Sep 16 04:42:19 UTC 2012


Hey guys - I have a piece of code like this:

if (ax < DBL_EPSILON && ay < DBL_EPSILON)
	if ((int)ax==0 && (int)ay==0) { /* raise inexact */
		if (sy == 0)
			return (cpack(m_pi_2 - x, copysign(ay, -1)));
		return (cpack(m_pi_2 - x, ay));
	}

Is there a good reason I didn't code it like this?

if (ax < DBL_EPSILON && ay < DBL_EPSILON)
	if ((int)ax==0 && (int)ay==0) /* raise inexact */
		return (cpack(m_pi_2 - x, -y));


I'm trying to remember if I coded it the second way, and one of you told 
me to code it the first way.  Or maybe I came up with the first way 
myself - maybe I wasn't sure what would happen if y was 0 or -0.

Thanks, Stephen


More information about the freebsd-numerics mailing list