summaryrefslogtreecommitdiff
path: root/src/math/fmax.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/math/fmax.c')
-rw-r--r--src/math/fmax.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/math/fmax.c b/src/math/fmax.c
index dc354ca3..7e5d8a61 100644
--- a/src/math/fmax.c
+++ b/src/math/fmax.c
@@ -4,7 +4,13 @@
TYPE TGFN(fmax)(TYPE x, TYPE y)
{
- return x - y;
+ if (isnan(x) && !isnan(y)) {
+ return y;
+ } else if (!isnan(x) && isnan(y)) {
+ return x;
+ }
+
+ return x > y ? x : y;
}
/*