sin(3)
โจ sin(3) โ the sine girlies ๐
okay so bestie, we're in section 3 of the manual (that's the library functions section, iykyk) and today's main character is sin. she's a Library Function and honestly? iconic. ๐
๐ธ NAME ๐ธ
sin, sinf, sinl โ the sine function, in three delicious flavors ๐
๐ LIBRARY ๐
Math library โ that's libm, and you link it with -lm. don't forget her or she will simply not show up. ๐ญ
โจ SYNOPSIS โจ
#include <math.h>
double sin(double x);
float sinf(float x);
long double sinl(long double x);
๐ง Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
for sinf(), sinl():
_ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
|| /* Since glibc 2.19: */ _DEFAULT_SOURCE
|| /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
like, yes, you have to ask for her nicely with the right macros. the vibes have โจpaperworkโจ. ๐ซถ
๐ DESCRIPTION ๐
These functions return the sine of x, where x is given in radians. that's it, that's the whole thing. radians only, bestie โ if you're out here passing degrees, that's on you and I can't help you. ๐ญ
๐ RETURN VALUE ๐
On success, these functions return the sine of x. slay. ๐
- If
xis aNaN, aNaNis returned. (a NaN in, a NaN out โ the circle of life ๐ฆ) - If
xis positive infinity or negative infinity, a domain error occurs, and aNaNis returned. no cap, infinities are simply not invited to this party. ๐
๐ฅ ERRORS ๐ฅ
See math_error(7) for info on how to figure out whether an error actually happened when you called these functions, because they're lowkey subtle about it.
The following errors can occur:
- Domain error:
xis an infinity โerrnois set toEDOM(but see BUGS, bestie, there's lore ๐). An invalid floating-point exception (FE_INVALID) is raised.
๐ ATTRIBUTES ๐
For an explanation of the terms used in this section, see attributes(7).
sin(),sinf(),sinl()โ Thread safety:MT-Safeโ
(we love a thread-safe queen. no drama, no data races, just math. ๐ซถ)
โญ STANDARDS โญ
C11, POSIX.1-2008. periodt. ๐
๐ฆ HISTORY ๐ฆ
C99, POSIX.1-2001.
The variant returning double also conforms to SVr4, 4.3BSD, C89 โ she's been around since basically forever, a true legacy icon. ๐
๐ BUGS ๐
Before glibc 2.10, the glibc implementation did not set errno to EDOM when a domain error occurred. so yeah, on ancient systems, the error reporting was giving nothing. not me defending it, I'm just the messenger. ๐
๐ SEE ALSO ๐
acos(3), asin(3), atan(3), atan2(3), cos(3), csin(3), sincos(3), tan(3)
(the whole trig friend group ๐ they're all invited to the group chat)
and that's the page, bestie!! this was sin(3) from Linux man-pages 6.20, dated 2026-02-08. go forth and sine responsibly โจ๐ธ๐
๐ฆ 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