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

TYPE TGFN(scalbn)(TYPE x, int n)
{
	SIGNAL_SAFE(0);
	switch (fpclassify(x)) {
	case FP_ZERO:		return x;
	case FP_INFINITE:	return x;
	default:		break;
	}

	if (n == 0) {
		return x;
	}

	return TGFN(ldexp)(x, n);
}

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