summaryrefslogtreecommitdiff
path: root/src/math/acosh.c
blob: 4830b0275984fd2bee4b44f6f1140d496e23cf53 (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)
*/