diff --git a/ChangeLog b/ChangeLog index ba42b5bd28..c08b711d7a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2016-12-14 Joseph Myers + [BZ #20947] + * math/s_fmax_template.c (M_DECL_FUNC (__fmax)): Add the arguments + when either is a signaling NaN. + * math/s_fmin_template.c (M_DECL_FUNC (__fmin)): Likewise. + * bits/long-double.h: New file. * sysdeps/ieee754/ldbl-128/bits/long-double.h: Likewise. * sysdeps/ieee754/ldbl-96/bits/long-double.h: Likewise. diff --git a/math/s_fmax_template.c b/math/s_fmax_template.c index dea53d45f0..e855b724bc 100644 --- a/math/s_fmax_template.c +++ b/math/s_fmax_template.c @@ -22,7 +22,14 @@ FLOAT M_DECL_FUNC (__fmax) (FLOAT x, FLOAT y) { - return (isgreaterequal (x, y) || isnan (y)) ? x : y; + if (isgreaterequal (x, y)) + return x; + else if (isless (x, y)) + return y; + else if (issignaling (x) || issignaling (y)) + return x + y; + else + return isnan (y) ? x : y; } declare_mgen_alias (__fmax, fmax); diff --git a/math/s_fmin_template.c b/math/s_fmin_template.c index b70989ac74..82009bb7e8 100644 --- a/math/s_fmin_template.c +++ b/math/s_fmin_template.c @@ -23,7 +23,14 @@ FLOAT M_DECL_FUNC (__fmin) (FLOAT x, FLOAT y) { - return (islessequal (x, y) || isnan (y)) ? x : y; + if (islessequal (x, y)) + return x; + else if (isgreater (x, y)) + return y; + else if (issignaling (x) || issignaling (y)) + return x + y; + else + return isnan (y) ? x : y; } declare_mgen_alias (__fmin, fmin);