diff options
Diffstat (limited to 'src/math/fdiml.c')
-rw-r--r-- | src/math/fdiml.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/math/fdiml.c b/src/math/fdiml.c new file mode 100644 index 00000000..cda3022e --- /dev/null +++ b/src/math/fdiml.c @@ -0,0 +1,17 @@ +#include "libm.h" + +#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 +long double fdiml(long double x, long double y) +{ + return fdim(x, y); +} +#else +long double fdiml(long double x, long double y) +{ + if (isnan(x)) + return x; + if (isnan(y)) + return y; + return x > y ? x - y : 0; +} +#endif |