summaryrefslogtreecommitdiff
path: root/src/math/logb.c
blob: 8dd29371b11cd1caa87a6516f2b032efd7c97c57 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# define TGSOURCE "logb.c"
#include "_tgmath.h"
#include <math.h>
#include "fenv.h"

TYPE TGFN(logb)(TYPE x)
{
	switch (fpclassify(x)) {
	case FP_ZERO:		feraiseexcept(FE_DIVBYZERO); return - INFINITY;
	case FP_INFINITE:	return x;
	default:		break;
	}

	return x;
}

/*
STDC(199901)
XOPEN(400)
LINK(m)
*/