Complex arg-trig functions
Stephen Montgomery-Smith
stephen at missouri.edu
Mon Aug 13 20:11:11 UTC 2012
On 08/13/2012 11:57 AM, Bruce Evans wrote:
> @ if (sy == 0)
> @ ! return (cpack(cimag(w), -creal(w)));
> @ ! return (cpack(-cimag(w), creal(w)));
>
> The sign of creal(cacos()) is always 1, but this makes it +- the sign
> of atan2(x, y).
Yes, but the sign of atan2(y,x) will always be the same as the sign of
y. So the two negatives will cancel.
But your code works just as well (and your code doesn't clobber the -0's
in the imaginary part).
>
> @ }
> @ }
> @ --- 408,420 ----
> @ @ if (ISFINITE(bx) && ISFINITE(by) && (x >
> RECIP_SQRT_EPSILON_100 || y > RECIP_SQRT_EPSILON_100)) {
> @ ! /* XXX following can also raise overflow */
I don't see how the code could raise an overflow. The output of clog
should always be very much less than DBL_MAX. (Originally I had
clog(2*z), and that could raise an unwarranted overflow.)
More information about the freebsd-numerics
mailing list