first commit of the new libm!
[musl] / src / math / fdiml.c
diff --git a/src/math/fdiml.c b/src/math/fdiml.c
new file mode 100644 (file)
index 0000000..cda3022
--- /dev/null
@@ -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