tan(3)
โจ tan(3) โ the tangent function, but make it make sense โจ
okay so bestie, welcome to the Library Functions Manual entry for tan(3) ๐ this is a section 3 page (that's the C library girlies) and it's literally just... the tangent function. three flavors of it. let's go ๐ฆ
๐ NAME ๐
tan, tanf, tanl โ tangent function
๐ LIBRARY ๐
Math library (libm, -lm)
link it with -lm or she will simply Not work. no cap.
๐ธ SYNOPSIS ๐ธ
#include <math.h>
double tan(double x);
float tanf(float x);
long double tanl(long double x);
๐ง Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
tanf(), tanl():
_ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
|| /* Since glibc 2.19: */ _DEFAULT_SOURCE
|| /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
๐ DESCRIPTION ๐
These functions return the tangent of x, where x is given in radians. that's it. that's the whole description. radians, not degrees โ I know, I know, tragic, but that's the vibe ๐
โญ RETURN VALUE โญ
On success, these functions return the tangent of x. iconic behaviour, honestly ๐
If x is a NaN, a NaN is returned. (NaN in, NaN out, the circle of life ๐)
If x is positive infinity or negative infinity, a domain error occurs, and a NaN is returned. she said nope ๐
If the correct result would overflow, a range error occurs, and the functions return HUGE_VAL, HUGE_VALF, or HUGE_VALL, respectively, with the mathematically correct sign. so like, huge but make it signed โจ
๐ญ ERRORS ๐ญ
See math_error(7) for information on how to determine whether an error has occurred when calling these functions. (fr fr, go read it, it's the receipts girlie ๐งพ)
The following errors can occur:
- Domain error:
xis an infinity โerrnois set toEDOM(but see BUGS). An invalid floating-point exception (FE_INVALID) is raised. ๐จ - Range error: result overflow โ An overflow floating-point exception (
FE_OVERFLOW) is raised.
๐ ATTRIBUTES ๐
For an explanation of the terms used in this section, see attributes(7).
tan(),tanf(),tanl()โ Thread safety:MT-Safe๐ซถ
MT-Safe means you can call her from multiple threads and she will not start drama. we love a low-maintenance queen.
๐ STANDARDS ๐
C11, POSIX.1-2008.
๐ฐ๏ธ HISTORY ๐ฐ๏ธ
C99, POSIX.1-2001.
The variant returning double also conforms to SVr4, 4.3BSD, C89. yes she's been around, she's a legacy icon ๐
๐ BUGS ๐
Before glibc 2.10, the glibc implementation did not set errno to EDOM when a domain error occurred. so if you're on some ancient glibc, don't trust the errno, bestie, check the floating-point exception instead ๐ญ
๐ฅ SEE ALSO ๐ฅ
acos(3), asin(3), atan(3), atan2(3), cos(3), ctan(3), sin(3)
the whole trig friend group. go say hi ๐
okay that's the page!! this cutie comes to you from Linux man-pages 6.20, dated 2026-02-08, and she ate, no crumbs ๐ โจ๐
๐ฆ where this page comes from
- arch rolling: man-pages 6.20-1 ยท BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages 6.20
- ๐ the page's license: Linux-man-pages-copyleft
- Copyright 1993, David Metcalfe <david@prism.demon.co.uk>
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms