1 #include <float.h>
2 #include <math.h>
3 
4 #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
fmaxl(long double x,long double y)5 long double fmaxl(long double x, long double y) {
6     return fmax(x, y);
7 }
8 #else
fmaxl(long double x,long double y)9 long double fmaxl(long double x, long double y) {
10     if (isnan(x))
11         return y;
12     if (isnan(y))
13         return x;
14     /* handle signed zeros, see C99 Annex F.9.9.2 */
15     if (signbit(x) != signbit(y))
16         return signbit(x) ? y : x;
17     return x < y ? y : x;
18 }
19 #endif
20