This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC] Fix PR28684
- From: Roger Sayle <roger at eyesopen dot com>
- To: Richard Guenther <rguenther at suse dot de>
- Cc: Revital1 Eres <ERES at il dot ibm dot com>, Ayal Zaks <ZAKS at il dot ibm dot com>, Dorit Nuzman <DORIT at il dot ibm dot com>, <gcc-patches at gcc dot gnu dot org>, "R. Clint Whaley" <whaley at cs dot utsa dot edu>
- Date: Tue, 14 Nov 2006 09:25:14 -0700 (MST)
- Subject: Re: [RFC] Fix PR28684
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.
Roger
--