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 x is a NaN, a NaN is returned. (a NaN in, a NaN out โ€” the circle of life ๐Ÿฆ‹)
  • If x is positive infinity or negative infinity, a domain error occurs, and a NaN is 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: x is an infinity โ€” errno is set to EDOM (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
  • ๐Ÿ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms