about summary refs log tree commit diff
path: root/math/s_fmax_template.c
diff options
context:
space:
mode:
Diffstat (limited to 'math/s_fmax_template.c')
-rw-r--r--math/s_fmax_template.c9
1 files changed, 8 insertions, 1 deletions
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);