[RFC] Fix PR28684

Roger Sayle roger@eyesopen.com
Tue Nov 14 17:22:00 GMT 2006

On Tue, 14 Nov 2006, Richard Guenther wrote:
> One popular reason of not using -ffast-math is that on i?86 it enables
> some "interesting" intrinsics (fsin, etc.) which are broken in multiple
> ways.  Another popular reason is that at least "strength reducing"
> divisions can have very bad impact on the stability of simulation codes.
> So from that perspective I would argue to split -freciprocal-math and
> -mfancy-math-387 (or what it is called - maybe just add a new
> -mbroken-math-387 flag) from -ffast-math making -ffast-math more usable?

This just another example of the trade-off between accuaracy and
precision.  The x87's fsin and fcos intrinsics almost always improve
the accuracy of sin and cos, by returning XFmode 80-bit results, by
default.  The fact that there are a handful of pathological input
values, that produce results worse than a few ulp, is dwarfed by the
benefits.  For highly critical trigonmetric applications, such as
calculating ephemeris data at NASA, using -ffast-math/fsin/fcos is
almost certainly likely to improve your results.  That sin(0.7) is
much better, whilst sin(2^90) is slightly worse might seem like a fair
trade-off to most folks, certainly probablistically.


More information about the Gcc-patches mailing list