1TAN(3P)                    POSIX Programmer's Manual                   TAN(3P)
2
3
4

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10

NAME

12       tan, tanf, tanl - tangent function
13

SYNOPSIS

15       #include <math.h>
16
17       double tan(double x);
18       float tanf(float x);
19       long double tanl(long double x);
20
21

DESCRIPTION

23       These functions shall compute the tangent of their argument x, measured
24       in radians.
25
26       An  application  wishing to check for error situations should set errno
27       to zero and  call  feclearexcept(FE_ALL_EXCEPT)  before  calling  these
28       functions.   On return, if errno is non-zero or fetestexcept(FE_INVALID
29       | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is non-zero, an error  has
30       occurred.
31

RETURN VALUE

33       Upon successful completion, these functions shall return the tangent of
34       x.
35
36       If the correct value would cause underflow, and is not representable, a
37       range  error may occur, and  either 0.0 (if supported), or an implemen‐
38       tation-defined value shall be returned.
39
40       If x is NaN, a NaN shall be returned.
41
42       If x is ±0, x shall be returned.
43
44       If x is subnormal, a range error may occur and x should be returned.
45
46       If x is ±Inf, a domain error shall occur, and either  a  NaN  (if  sup‐
47       ported), or an implementation-defined value shall be returned.
48
49       If  the  correct  value  would cause underflow, and is representable, a
50       range error may occur and the correct value shall be returned.
51
52       If the correct value would cause overflow, a range  error  shall  occur
53       and  tan(),  tanf(), and tanl() shall return ±HUGE_VAL, ±HUGE_VALF, and
54       ±HUGE_VALL, respectively, with the same sign as the  correct  value  of
55       the function.
56

ERRORS

58       These functions shall fail if:
59
60       Domain Error
61              The value of x is ±Inf.
62
63       If  the integer expression (math_errhandling & MATH_ERRNO) is non-zero,
64       then  errno  shall  be  set  to  [EDOM].  If  the  integer   expression
65       (math_errhandling  &  MATH_ERREXCEPT)  is  non-zero,  then  the invalid
66       floating-point exception shall be raised.
67
68       Range Error
69              The result overflows
70
71       If the integer expression (math_errhandling & MATH_ERRNO) is  non-zero,
72       then  errno  shall  be  set  to  [ERANGE].  If  the  integer expression
73       (math_errhandling & MATH_ERREXCEPT)  is  non-zero,  then  the  overflow
74       floating-point exception shall be raised.
75
76
77       These functions may fail if:
78
79       Range Error
80              The result underflows,  or the value of x is subnormal.
81
82       If  the integer expression (math_errhandling & MATH_ERRNO) is non-zero,
83       then errno  shall  be  set  to  [ERANGE].  If  the  integer  expression
84       (math_errhandling  &  MATH_ERREXCEPT)  is  non-zero, then the underflow
85       floating-point exception shall be raised.
86
87
88       The following sections are informative.
89

EXAMPLES

91   Taking the Tangent of a 45-Degree Angle
92              #include <math.h>
93              ...
94              double radians = 45.0 * M_PI / 180;
95              double result;
96              ...
97              result = tan (radians);
98

APPLICATION USAGE

100       There are no known floating-point representations such that for a  nor‐
101       mal argument, tan( x) is either overflow or underflow.
102
103       These  functions may lose accuracy when their argument is near a multi‐
104       ple of pi/2 or is far from 0.0.
105
106       On  error,  the  expressions  (math_errhandling   &   MATH_ERRNO)   and
107       (math_errhandling  & MATH_ERREXCEPT) are independent of each other, but
108       at least one of them must be non-zero.
109

RATIONALE

111       None.
112

FUTURE DIRECTIONS

114       None.
115

SEE ALSO

117       atan(), feclearexcept(), fetestexcept(), isnan(), the Base  Definitions
118       volume of IEEE Std 1003.1-2001, Section 4.18, Treatment of Error Condi‐
119       tions for Mathematical Functions, <math.h>
120
122       Portions of this text are reprinted and reproduced in  electronic  form
123       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
124       -- Portable Operating System Interface (POSIX),  The  Open  Group  Base
125       Specifications  Issue  6,  Copyright  (C) 2001-2003 by the Institute of
126       Electrical and Electronics Engineers, Inc and The Open  Group.  In  the
127       event of any discrepancy between this version and the original IEEE and
128       The Open Group Standard, the original IEEE and The Open Group  Standard
129       is  the  referee document. The original Standard can be obtained online
130       at http://www.opengroup.org/unix/online.html .
131
132
133
134IEEE/The Open Group                  2003                              TAN(3P)
Impressum