1#include <float.h>
2#include <math.h>
3
4#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
5long double fdiml(long double x, long double y) {
6    return fdim(x, y);
7}
8#else
9long double fdiml(long double x, long double y) {
10    if (isnan(x))
11        return x;
12    if (isnan(y))
13        return y;
14    return x > y ? x - y : 0;
15}
16#endif
17