summaryrefslogblamecommitdiff
path: root/src/math/logbf.c
blob: 934827f885b7e388eacce766cdd30090fc329487 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12











                                             
#include <limits.h>
#include "libm.h"

float logbf(float x) {
	int i = ilogbf(x);

	if (i == FP_ILOGB0)
		return -1.0f/fabsf(x);
	if (i == FP_ILOGBNAN || i == INT_MAX)
		return x * x;
	return i;
}