On 2005-05-30 11:51:59 -0400, Scott Robert Ladd wrote:
> The fact that trigonometric functions can extended beyond 2D geometry in
> no way invalidates their use in their original domain. I've written many
> 2D and 3D applications over the years without need for a sine outside
> the range [0, 2*PI] (or [-PI, PI] in some cases). Some people live and
> die by one of those programs, and no one's died yet because I used
> -ffast-math in compiling it.

I wonder if compilers could use information for assertions.
For instance, instead of writing sin(x), you could write:

  sin((assert(x >= 0 && x <= 2 * pi), x))

possibly via a macro. IMHO, this would be better than using
switches such as -ffast-math, and you could mix small ranges
and large ranges in the same program.

-- 
Vincent Lefèvre <[EMAIL PROTECTED]> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / SPACES project at LORIA

Reply via email to