[Bug libquadmath/114140] different results for std::fmin/std::fmax and quadmath fminq/fmaxq if one argument=signaling_NaN

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Feb 28 01:06:39 GMT 2024


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114140

--- Comment #10 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to g.peterhoff from comment #7)
> I think there is a misunderstanding. The problem is that std::fmin/std::fmax
> and quadmath fminq/fmaxq give different results when only *one* argument is
> signaling_NaN.
> The standard (https://en.cppreference.com/w/cpp/numeric/math/fmin +
> https://en.cppreference.com/w/cpp/numeric/math/fmax) says:
> * If one of the two arguments is NaN, the value of the other argument is
> returned
> * Only if both arguments are NaN, NaN is returned
> 
> quadmath fminq/fmaxq also return NaN if only *one* argument is signaling_NaN.

The cppreference page is wrong.
See https://sourceware.org/bugzilla/show_bug.cgi?id=20947 for reference on why.


More information about the Gcc-bugs mailing list