xref: /haiku/src/system/libroot/posix/musl/math/fmax.c (revision 15fb7d88e971c4d6c787c6a3a5c159afb1ebf77b)
1 #include <math.h>
2 
3 double fmax(double x, double y)
4 {
5 	if (isnan(x))
6 		return y;
7 	if (isnan(y))
8 		return x;
9 	/* handle signed zeros, see C99 Annex F.9.9.2 */
10 	if (signbit(x) != signbit(y))
11 		return signbit(x) ? y : x;
12 	return x < y ? y : x;
13 }
14