README: Update links
[man-pages.git] / man3 / tan.3
blobf91a322080e8303bddc5eaa86890a49875134218
1 '\" t
2 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
3 .\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk
4 .\"     <mtk.manpages@gmail.com>
5 .\"
6 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
7 .\"
8 .\" References consulted:
9 .\"     Linux libc source code
10 .\"     Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
11 .\"     386BSD man pages
12 .\" Modified 1993-07-24 by Rik Faith (faith@cs.unc.edu)
13 .\" Modified 2002-07-27 by Walter Harms
14 .\"     (walter.harms@informatik.uni-oldenburg.de)
15 .\"
16 .TH tan 3 (date) "Linux man-pages (unreleased)"
17 .SH NAME
18 tan, tanf, tanl \- tangent function
19 .SH LIBRARY
20 Math library
21 .RI ( libm ", " \-lm )
22 .SH SYNOPSIS
23 .nf
24 .B #include <math.h>
26 .BI "double tan(double " x );
27 .BI "float tanf(float " x );
28 .BI "long double tanl(long double " x );
29 .fi
31 .RS -4
32 Feature Test Macro Requirements for glibc (see
33 .BR feature_test_macros (7)):
34 .RE
36 .BR tanf (),
37 .BR tanl ():
38 .nf
39     _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
40         || /* Since glibc 2.19: */ _DEFAULT_SOURCE
41         || /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
42 .fi
43 .SH DESCRIPTION
44 These functions return the tangent of
45 .IR x ,
46 where
47 .I x
49 given in radians.
50 .SH RETURN VALUE
51 On success, these functions return the tangent of
52 .IR x .
55 .I x
56 is a NaN, a NaN is returned.
59 .I x
60 is positive infinity or negative infinity,
61 a domain error occurs,
62 and a NaN is returned.
64 If the correct result would overflow,
65 a range error occurs,
66 and the functions return
67 .BR HUGE_VAL ,
68 .BR HUGE_VALF ,
70 .BR HUGE_VALL ,
71 respectively, with the mathematically correct sign.
72 .\" I think overflow can't occur, because the closest floating-point
73 .\" representation of pi/2 is still not close enough to pi/2 to
74 .\" produce a large enough value to overflow.
75 .\" Testing certainly seems to bear this out.  -- mtk, Jul 08
76 .\"
77 .\" POSIX.1 allows an optional underflow error;
78 .\" glibc 2.8 doesn't do this
79 .\" POSIX.1 an optional range error for subnormal x;
80 .\" glibc 2.8 doesn't do this
81 .SH ERRORS
82 See
83 .BR math_error (7)
84 for information on how to determine whether an error has occurred
85 when calling these functions.
87 The following errors can occur:
88 .TP
89 Domain error: \fIx\fP is an infinity
90 .I errno
91 is set to
92 .B EDOM
93 (but see BUGS).
94 An invalid floating-point exception
95 .RB ( FE_INVALID )
96 is raised.
97 .TP
98 Range error: result overflow
99 .\" Unable to test this case, since the best approximation of
100 .\" pi/2 in double precision only yields a tan() value of 1.633e16.
101 .\" .I errno
102 .\" is set to
103 .\" .BR ERANGE .
104 An overflow floating-point exception
105 .RB ( FE_OVERFLOW )
106 is raised.
107 .SH ATTRIBUTES
108 For an explanation of the terms used in this section, see
109 .BR attributes (7).
111 allbox;
112 lbx lb lb
113 l l l.
114 Interface       Attribute       Value
118 .BR tan (),
119 .BR tanf (),
120 .BR tanl ()
121 T}      Thread safety   MT-Safe
123 .SH STANDARDS
124 C11, POSIX.1-2008.
125 .SH HISTORY
126 C99, POSIX.1-2001.
128 The variant returning
129 .I double
130 also conforms to
131 SVr4, 4.3BSD, C89.
132 .SH BUGS
133 Before glibc 2.10, the glibc implementation did not set
134 .\" http://sourceware.org/bugzilla/show_bug.cgi?id=6782
135 .I errno
137 .B EDOM
138 when a domain error occurred.
139 .SH SEE ALSO
140 .BR acos (3),
141 .BR asin (3),
142 .BR atan (3),
143 .BR atan2 (3),
144 .BR cos (3),
145 .BR ctan (3),
146 .BR sin (3)