LABS(3POSIX)
π LABS(3POSIX) β the POSIX Programmer's Manual, bestie edition π
okay so before we even get into it: this is labs, llabs, from the POSIX Programmer's Manual. It's filed under LABS(3POSIX), and it is exactly the kind of page that looks scary and is actually just "number, but positive." Let's go. π¦
πΈ PROLOG πΈ
This manual page is part of the POSIX Programmer's Manual. Heads up, bestie, real talk:
- The Linux implementation of this interface may differ β so go check the corresponding Linux manual page for the deets on Linux behavior.
- Or⦠the interface may not be implemented on Linux at all.
It's giving "read the room before you ship." π
β¨ NAME β¨
labs, llabs β return a long integer absolute value
(Yes that's both of them in one NAME line. They're a duo. Main characters. π)
π SYNOPSIS π
#include <stdlib.h>
long labs(long i);
long long llabs(long long i);
Look at that. Clean. Minimal. Ate. π₯
π DESCRIPTION π
So the functionality described on this reference page is aligned with the ISO C standard. And if there's any conflict between what's written here and the ISO C standard? That conflict is unintentional β this volume of POSIX.1β2017 defers to the ISO C standard. No drama, the ISO C standard is the authority here. periodt.
Now the actual tea:
- The
labs()function shall compute the absolute value of the long integer operandi. - The
llabs()function shall compute the absolute value of the long long integer operandi.
And here's the important bit, do NOT skip this:
If the result cannot be represented, the behavior is undefined. π So like, know your ranges. This is not the function to be reckless with.
π RETURN VALUE π
- The
labs()function shall return the absolute value of the long integer operand. - The
llabs()function shall return the absolute value of the long long integer operand.
That's it. That's the whole return section. It does the one thing and it does it well. β
π ERRORS π
No errors are defined.
Iconic. Zero notes. Nothing to handle, nothing to check, just vibes. π§
The following sections are informative. (So they're the "for your information" part of the page β not normative requirements. Keep that in mind.)
π EXAMPLES π
None.
Honestly? Respect. Sometimes the example is justβ¦ using it. π
π«Ά APPLICATION USAGE π«Ά
None.
π RATIONALE π
None.
The rationale is on vacation. It has left the building. We love that for it. β¨
πΈ FUTURE DIRECTIONS πΈ
None.
Nothing's changing. Stable. Consistent. Loyal. Lowkey the ideal function. π
π SEE ALSO π
abs()- The Base Definitions volume of
POSIX.1β2017,<stdlib.h>
π COPYRIGHT π
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.
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. Like, that's the final boss. That's the source of truth.
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.
okay and that's the whole page, bestie!! π big love to IEEE/The Open Group, who shipped this in 2017 under the LABS(3POSIX) name β absolute legends, no cap. go take the absolute value of something. safely. within range. πβ¨π¦
π¦ where this page comes from
- debian bookworm: manpages-posix-dev 2017a-2 Β· Other
- debian trixie: manpages-posix-dev 2017a-2 Β· Other
- ubuntu jammy: manpages-posix-dev 2017a-2 Β· Other
- ubuntu noble: manpages-posix-dev 2017a-2 Β· Other
- ubuntu resolute: manpages-posix-dev 2017a-2build1 Β· Other
- ubuntu stonking: manpages-posix-dev 2017a-2.1 Β· Other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms