http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57994
--- Comment #4 from Marc Glisse <glisse at gcc dot gnu.org> --- The MPFR documentation does claim that it strictly conforms to annex F (with an explanation on how to emulate subnormals), though it isn't clear if that claim only concerns +-*/sqrt or everything. (In reply to jos...@codesourcery.com from comment #2) > There are no errno issues - this is an exact zero result, not underflow. > But I'm not confident that MPFR follows all the Annex F special cases for > infinities and NaNs (and even less confident in MPC following Annex G), > and in cases that are errors and should produce exceptions / errno (e.g. > sin (Inf)) you do of course need to avoid folding. I was wondering about that last point. Couldn't we replace: x=sin(Inf); with: x=NaN; errno=EDOM; // only if flag_math_errno volatile double f=NaN+NaN; // if flag_trapping_math, something to raise invalid (make sure we don't recursively try to propagate the constant there, so maybe the NaN argument should be volatile) Ok, NaN may not be the most interesting case to propagate, but infinities are interesting, even when they would give EDOM / FE_OVERFLOW. Though the compiler might need help from the front-end finding the variable errno and the values EDOM and FE_OVERFLOW if it needs them explicitly. Of course, doing the infinity propagation only in the !flag_math_errno && !flag_trapping_math (and I guess !flag_rounding_math) case is a natural first step.