SIGNBIT(3POSIX)

πŸ’– SIGNBIT(3POSIX) πŸ’–

okay bestie, so this one lives in the POSIX Programmer's Manual β€” that's the manual name, and the page itself is all about signbit, which is genuinely one of the most chill little macros in <math.h>. it's giving "tiny function, big feelings". let's get into it πŸ’…


✨ PROLOG ✨

so like, this manual page is part of the POSIX Programmer's Manual. that's the whole vibe. but heads up bestie:

the Linux implementation of this interface may differ β€” so if you're on Linux, go consult the corresponding Linux manual page for the details of how Linux actually does it. OR, plot twist, the interface might not even be implemented on Linux at all. πŸ™ˆ

so yeah. check your local situation, no cap.


🌸 NAME 🌸

signbit β€” test sign ✨


πŸŽ€ SYNOPSIS πŸŽ€

#include <math.h>

int signbit(real-floating x);

that's it. that's the whole entrance. short, iconic, main character energy πŸ‘‘


πŸ¦‹ DESCRIPTION πŸ¦‹

so first things first, the functionality described on this reference page is aligned with the ISO C standard. any conflict between what's written here and the ISO C standard? unintentional, fr fr. this volume of POSIX.1‐2017 defers to the ISO C standard. periodt.

now the actual tea: the signbit() macro shall determine whether the sign of its argument value is negative. 🧐

and here's the part that lowkey blows people's minds:

NaNs, zeros, and infinities have a sign bit.

yes bestie, even zero has a sign. negative zero is a real thing and it's out here living its life. πŸ’€


⭐ RETURN VALUE ⭐

the signbit() macro shall return a non-zero value if and only if the sign of its argument value is negative. that's it. non-zero = negative sign, zero = not negative sign. clean, simple, no drama. 🌈


πŸ’œ ERRORS πŸ’œ

no errors are defined. πŸ’… like, none. not a single one. we're unbothered.

the following sections are informative (iykyk β€” they're just here for the vibes, not the rules).


πŸ“ EXAMPLES πŸ“

none. 😭 girl really said "figure it out bestie".


🧚 APPLICATION USAGE 🧚

none. again. the confidence is unmatched honestly.


πŸ”₯ RATIONALE πŸ”₯

none. she's mysterious. she's enigmatic. she's a macro that just works.


🌈 FUTURE DIRECTIONS 🌈

none. nothing's changing. she's perfect as she is. πŸ‘‘


🫢 SEE ALSO 🫢

  • fpclassify()
  • isfinite()
  • isinf()
  • isnan()
  • isnormal()

the Base Definitions volume of POSIX.1‐2017, <math.h> ✨

(the whole <math.h> friend group honestly β€” they all hang out together)


okay so the legal bit, but make it cute:

portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group.

and in the event of any discrepancy between this version and the original IEEE and The Open Group Standard? the original IEEE and The Open Group Standard is the referee document. so if there's beef, the original wins. no contest.

the original Standard can be obtained online at http://www.opengroup.org/unix/online.html .

any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. to report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html . πŸ›


and that's the whole page bestie!! πŸ’– this one came to you courtesy of IEEE/The Open Group, 2017 β€” SIGNBIT(3POSIX), signing off. go check your sign bits, stay non-zero, and remember: even zero has a sign. slay πŸŽ€βœ¨