summaryrefslogtreecommitdiff
path: root/src/math/tan.c
blob: 16d83d78fc336ed2e0b8e97c32add9f7a2af2eb6 (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 "tan.c"
#include <math.h>
#include "nonstd/tgmath.h"
#include "errno.h"

/** tangent **/
TYPE TGFN(tan)(TYPE x)
{
	if (0) {
		errno = ERANGE; /* The result cannot be represented */
		/* RETURN_FAILURE(CONSTANT(HUGE_VAL), A range error occurred); */
		return TGHUGE;
	}

	/* RETURN_SUCCESS(the tangent of ARGUMENT(x)); */
	return TGFN(sin)(x) / TGFN(cos)(x);
}

/***
compute the tanget of ARGUMENT(x), in radians.
***/

/*
IMPLEMENTATION(The value returned on a domain error, CONSTANT(HUGE_VAL))
LINK(m)
*/
/*
STDC(1)
*/