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