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
11

NAME

13       tan, tanf, tanl — tangent function
14

SYNOPSIS

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

DESCRIPTION

23       The functionality described on this reference page is aligned with  the
24       ISO C  standard.  Any  conflict between the requirements described here
25       and the ISO C standard is unintentional. This  volume  of  POSIX.1‐2008
26       defers to the ISO C standard.
27
28       These functions shall compute the tangent of their argument x, measured
29       in radians.
30
31       An application wishing to check for error situations should  set  errno
32       to  zero  and  call  feclearexcept(FE_ALL_EXCEPT)  before calling these
33       functions. On return, if errno is non-zero or fetestexcept(FE_INVALID |
34       FE_DIVBYZERO  |  FE_OVERFLOW  | FE_UNDERFLOW) is non-zero, an error has
35       occurred.
36

RETURN VALUE

38       Upon successful completion, these functions shall return the tangent of
39       x.
40
41       If the correct value would cause underflow, and is not representable, a
42       range error may occur, and tan(), tanf(), and tanl() shall return  0.0,
43       or  (if  IEC  60559 Floating-Point is not supported) an implementation-
44       defined value no  greater  in  magnitude  than  DBL_MIN,  FLT_MIN,  and
45       LDBL_MIN, respectively.
46
47       If x is NaN, a NaN shall be returned.
48
49       If x is ±0, x shall be returned.
50
51       If x is subnormal, a range error may occur
52       and x should be returned.
53
54       If  x is not returned, tan(), tanf(), and tanl() shall return an imple‐
55       mentation-defined value no greater in magnitude than DBL_MIN,  FLT_MIN,
56       and LDBL_MIN, respectively.
57
58       If  x  is  ±Inf,  a domain error shall occur, and either a NaN (if sup‐
59       ported), or an implementation-defined value shall be returned.
60
61       If the correct value would cause underflow,  and  is  representable,  a
62       range error may occur and the correct value shall be returned.
63
64       If  the  correct  value would cause overflow, a range error shall occur
65       and tan(), tanf(), and tanl() shall return ±HUGE_VAL,  ±HUGE_VALF,  and
66       ±HUGE_VALL,  respectively,  with  the same sign as the correct value of
67       the function.
68

ERRORS

70       These functions shall fail if:
71
72       Domain Error
73                   The value of x is ±Inf.
74
75                   If the integer expression (math_errhandling  &  MATH_ERRNO)
76                   is  non-zero,  then  errno  shall be set to [EDOM].  If the
77                   integer expression (math_errhandling &  MATH_ERREXCEPT)  is
78                   non-zero,  then  the invalid floating-point exception shall
79                   be raised.
80
81       Range Error The result overflows
82
83                   If the integer expression (math_errhandling  &  MATH_ERRNO)
84                   is  non-zero,  then errno shall be set to [ERANGE].  If the
85                   integer expression (math_errhandling &  MATH_ERREXCEPT)  is
86                   non-zero,  then the overflow floating-point exception shall
87                   be raised.
88
89       These functions may fail if:
90
91       Range Error The result underflows, or the value of x is subnormal.
92
93                   If the integer expression (math_errhandling  &  MATH_ERRNO)
94                   is  non-zero,  then errno shall be set to [ERANGE].  If the
95                   integer expression (math_errhandling &  MATH_ERREXCEPT)  is
96                   non-zero, then the underflow floating-point exception shall
97                   be raised.
98
99       The following sections are informative.
100

EXAMPLES

102   Taking the Tangent of a 45-Degree Angle
103           #include <math.h>
104           ...
105           double radians = 45.0 * M_PI / 180;
106           double result;
107           ...
108           result = tan (radians);
109

APPLICATION USAGE

111       There are no known floating-point representations such that for a  nor‐
112       mal argument, tan(x) is either overflow or underflow.
113
114       These  functions may lose accuracy when their argument is near a multi‐
115       ple of π/2 or is far from 0.0.
116
117       On  error,  the  expressions  (math_errhandling   &   MATH_ERRNO)   and
118       (math_errhandling  & MATH_ERREXCEPT) are independent of each other, but
119       at least one of them must be non-zero.
120

RATIONALE

122       None.
123

FUTURE DIRECTIONS

125       None.
126

SEE ALSO

128       atan(), feclearexcept(), fetestexcept(), isnan()
129
130       The Base Definitions volume of POSIX.1‐2008, Section 4.19, Treatment of
131       Error Conditions for Mathematical Functions, <math.h>
132
134       Portions  of  this text are reprinted and reproduced in electronic form
135       from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
136       --  Portable  Operating  System  Interface (POSIX), The Open Group Base
137       Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
138       cal  and  Electronics  Engineers,  Inc  and  The  Open Group.  (This is
139       POSIX.1-2008 with the 2013 Technical Corrigendum  1  applied.)  In  the
140       event of any discrepancy between this version and the original IEEE and
141       The Open Group Standard, the original IEEE and The Open Group  Standard
142       is  the  referee document. The original Standard can be obtained online
143       at http://www.unix.org/online.html .
144
145       Any typographical or formatting errors that appear  in  this  page  are
146       most likely to have been introduced during the conversion of the source
147       files to man page format. To report such errors,  see  https://www.ker
148       nel.org/doc/man-pages/reporting_bugs.html .
149
150
151
152IEEE/The Open Group                  2013                              TAN(3P)
Impressum