On Mon, Jul 27, 2009 at 10:07 PM, Barton Willis<willisb at unk.edu> wrote:
> For real x, atan2(sin(x),cos(x)) = %pi - mod(%pi - x, 2 * %pi) is an
> identity.
> But %pi - mod(%pi - x, 2 * %pi) can be a mess too.
Maybe that kind of mess is OK if it has to be evoked by an
explicit function call (not part of the automatic simplification).
Other possibilities -- How about
atan2(sin(x),cos(x)) => if abs(x) < %pi then x else atan2(sin(x),cos(x))
or maybe just refuse to simplify unless abs(x) is known to be < %pi.
FWIW
Robert