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

DESCRIPTION

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

RETURN VALUE

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

ERRORS

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

EXAMPLES

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

APPLICATION USAGE

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

RATIONALE

121       None.
122

FUTURE DIRECTIONS

124       None.
125

SEE ALSO

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