summaryrefslogtreecommitdiff
path: root/src/math/acosh.c
blob: f557c875fcf13fd030a4d7d825f2c37875f4dfb4 (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
25
26
27
28
# define TGSOURCE "acosh.c"
#include "_tgmath.h"
#include <math.h>
#include "fenv.h"

TYPE TGFN(acosh)(TYPE x)
{
	if (x == 1.0) {
		return 0.0;
	}

	if (x < 1.0) {
		feraiseexcept(FE_INVALID);
		return NAN;
	}

	if (fpclassify(x) == FP_INFINITE && !signbit(x)) {
		return x;
	}

	return x;
}

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