shithub: npe

ref: 8d59ff3b29f759e550dc421b8cd14d96b83b5001
dir: /libnpe/log2.c/

View raw version
#include <math.h>

#define ln2o1 1.4426950408889634073599
#define huge 1.79769313486231e+308

double
log2(double x)
{
	if(x == 0)
		return -huge;
	if(x < 0 || isNaN(x))
		return NaN();

	return log(x)*ln2o1;
}