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>
6 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
8 .\" References consulted:
9 .\" Linux libc source code
10 .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
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)
16 .TH tan 3 (date) "Linux man-pages (unreleased)"
18 tan, tanf, tanl \- tangent function
21 .RI ( libm ", " \-lm )
26 .BI "double tan(double " x );
27 .BI "float tanf(float " x );
28 .BI "long double tanl(long double " x );
32 Feature Test Macro Requirements for glibc (see
33 .BR feature_test_macros (7)):
39 _ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
40 || /* Since glibc 2.19: */ _DEFAULT_SOURCE
41 || /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
44 These functions return the tangent of
51 On success, these functions return the tangent of
56 is a NaN, a NaN is returned.
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,
66 and the functions return
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
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
84 for information on how to determine whether an error has occurred
85 when calling these functions.
87 The following errors can occur:
89 Domain error: \fIx\fP is an infinity
94 An invalid floating-point exception
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.
104 An overflow floating-point exception
108 For an explanation of the terms used in this section, see
114 Interface Attribute Value
121 T} Thread safety MT-Safe
128 The variant returning
133 Before glibc 2.10, the glibc implementation did not set
134 .\" http://sourceware.org/bugzilla/show_bug.cgi?id=6782
138 when a domain error occurred.