summaryrefslogtreecommitdiff
path: root/src/math/atanh.c
blob: d33e91eaaba77cb2ec6dc44bfc65c5225585b775 (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
29
# define TGSOURCE "atanh.c"
#include "_tgmath.h"
#include <math.h>
#include <fenv.h>

TYPE TGFN(atanh)(TYPE x)
{
	if (fpclassify(x) == FP_ZERO) {
		return x;
	}

	if (TGFN(fabs)(x) == 1.0) {
		feraiseexcept(FE_DIVBYZERO);
		return copysign(INFINITY, x);
	}

	if (TGFN(fabs)(x) > 1.0) {
		feraiseexcept(FE_INVALID);
		return NAN;
	}

	return x;
}

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