diff options
Diffstat (limited to 'math')
-rw-r--r-- | math/s_fmax_template.c | 9 | ||||
-rw-r--r-- | math/s_fmin_template.c | 9 |
2 files changed, 16 insertions, 2 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); 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); |