]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/tan.3
acos.3, acosh.3, asin.3, asinh.3, atan.3, atan2.3, atanh.3, cabs.3, cacos.3, cacosh...
[thirdparty/man-pages.git] / man3 / tan.3
1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
2 .\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk
3 .\" <mtk.manpages@gmail.com>
4 .\"
5 .\" %%%LICENSE_START(VERBATIM)
6 .\" Permission is granted to make and distribute verbatim copies of this
7 .\" manual provided the copyright notice and this permission notice are
8 .\" preserved on all copies.
9 .\"
10 .\" Permission is granted to copy and distribute modified versions of this
11 .\" manual under the conditions for verbatim copying, provided that the
12 .\" entire resulting derived work is distributed under the terms of a
13 .\" permission notice identical to this one.
14 .\"
15 .\" Since the Linux kernel and libraries are constantly changing, this
16 .\" manual page may be incorrect or out-of-date. The author(s) assume no
17 .\" responsibility for errors or omissions, or for damages resulting from
18 .\" the use of the information contained herein. The author(s) may not
19 .\" have taken the same level of care in the production of this manual,
20 .\" which is licensed free of charge, as they might when working
21 .\" professionally.
22 .\"
23 .\" Formatted or processed versions of this manual, if unaccompanied by
24 .\" the source, must acknowledge the copyright and authors of this work.
25 .\" %%%LICENSE_END
26 .\"
27 .\" References consulted:
28 .\" Linux libc source code
29 .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
30 .\" 386BSD man pages
31 .\" Modified 1993-07-24 by Rik Faith (faith@cs.unc.edu)
32 .\" Modified 2002-07-27 by Walter Harms
33 .\" (walter.harms@informatik.uni-oldenburg.de)
34 .\"
35 .TH TAN 3 2015-03-02 "" "Linux Programmer's Manual"
36 .SH NAME
37 tan, tanf, tanl \- tangent function
38 .SH SYNOPSIS
39 .nf
40 .B #include <math.h>
41 .sp
42 .BI "double tan(double " x );
43 .br
44 .BI "float tanf(float " x );
45 .br
46 .BI "long double tanl(long double " x );
47 .fi
48 .sp
49 Link with \fI\-lm\fP.
50 .sp
51 .in -4n
52 Feature Test Macro Requirements for glibc (see
53 .BR feature_test_macros (7)):
54 .in
55 .sp
56 .ad l
57 .BR tanf (),
58 .BR tanl ():
59 .RS 4
60 _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE ||
61 _POSIX_C_SOURCE\ >=\ 200112L;
62 .br
63 or
64 .I cc\ -std=c99
65 .RE
66 .ad
67 .SH DESCRIPTION
68 These functions return the tangent of
69 .IR x ,
70 where
71 .I x
72 is
73 given in radians.
74 .SH RETURN VALUE
75 On success, these functions return the tangent of
76 .IR x .
77
78 If
79 .I x
80 is a NaN, a NaN is returned.
81
82 If
83 .I x
84 is positive infinity or negative infinity,
85 a domain error occurs,
86 and a NaN is returned.
87
88 If the correct result would overflow,
89 a range error occurs,
90 and the functions return
91 .BR HUGE_VAL ,
92 .BR HUGE_VALF ,
93 or
94 .BR HUGE_VALL ,
95 respectively, with the mathematically correct sign.
96 .\" I think overflow can't occur, because the closest floating-point
97 .\" representation of pi/2 is still not close enough to pi/2 to
98 .\" produce a large enough value to overflow.
99 .\" Testing certainly seems to bear this out. -- mtk, Jul 08
100 .\"
101 .\" POSIX.1 allows an optional underflow error;
102 .\" glibc 2.8 doesn't do this
103 .\" POSIX.1 an optional range error for subnormal x;
104 .\" glibc 2.8 doesn't do this
105 .SH ERRORS
106 See
107 .BR math_error (7)
108 for information on how to determine whether an error has occurred
109 when calling these functions.
110 .PP
111 The following errors can occur:
112 .TP
113 Domain error: \fIx\fP is an infinity
114 .I errno
115 is set to
116 .BR EDOM
117 (but see BUGS).
118 An invalid floating-point exception
119 .RB ( FE_INVALID )
120 is raised.
121 .TP
122 Range error: result overflow
123 .\" Unable to test this case, since the best approximation of
124 .\" pi/2 in double precision only yields a tan() value of 1.633e16.
125 .\" .I errno
126 .\" is set to
127 .\" .BR ERANGE .
128 An overflow floating-point exception
129 .RB ( FE_OVERFLOW )
130 is raised.
131 .SH ATTRIBUTES
132 For an explanation of the terms used in this section, see
133 .BR attributes (7).
134 .TS
135 allbox;
136 lbw21 lb lb
137 l l l.
138 Interface Attribute Value
139 T{
140 .BR tan (),
141 .BR tanf (),
142 .BR tanl ()
143 T} Thread safety MT-Safe
144 .TE
145 .SH CONFORMING TO
146 C99, POSIX.1-2001, POSIX.1-2008.
147
148 The variant returning
149 .I double
150 also conforms to
151 SVr4, 4.3BSD, C89.
152 .SH BUGS
153 Before version 2.10, the glibc implementation did not set
154 .\" http://sourceware.org/bugzilla/show_bug.cgi?id=6782
155 .I errno
156 to
157 .B EDOM
158 when a domain error occurred.
159 .SH SEE ALSO
160 .BR acos (3),
161 .BR asin (3),
162 .BR atan (3),
163 .BR atan2 (3),
164 .BR cos (3),
165 .BR ctan (3),
166 .BR sin (3)