aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--math/s_fmax_template.c9
-rw-r--r--math/s_fmin_template.c9
3 files changed, 21 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index ba42b5b..c08b711 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2016-12-14 Joseph Myers <joseph@codesourcery.com>
+ [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 dea53d4..e855b72 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 b70989a..82009bb 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);