shithub: npe

ref: e8d44e6791e9568d0a4e3291d15692f9223870f1
dir: /libnpe/fmax.c/

View raw version
#include <math.h>
/* taken from musl */

#define _sign(d) (*((u64int*)d) & (1ULL<<63))

double
fmax(double x, double y)
{
	if(isNaN(x))
		return y;
	if(isNaN(y))
		return x;
	if(_sign(&x) != _sign(&y))
		return _sign(&x) ? y : x;
	return x < y ? y : x;
}