This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Some more trigonometric optimizations


> 	-sin(x) = sin(-x)
> 	-tan(x) = tan(-x)
> 	-atan(x) = atan(-x)

I suppose moving the minus signs outside the argument make these expressions
more canonical somehow?

> 	sin(x)/cos(x) = tan(x)
> 	cos(x)/sin(x) = 1.0/tan(x)
> 	tan(x)*cos(x) = sin(x)
> 	cos(x)*tan(x) = sin(x)
> 	sin(x)/tan(x) = cos(x)
> 	tan(x)/sin(x) = 1.0/cos(x)

These all get the "wrong" answer when the numerator and denominator have
common zeros (or the multiplicand is zero and the multiplier is infinite),
but they're OK, I guess for unsafe-math-optimizations.

Brad


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]