ABS(3P)

πŸ’– ABS(3P) β€” bestie edition πŸ’–

okay so welcome to the POSIX Programmer's Manual, the abs page, and honestly? it's a short one. a little snack. a lil' bite-sized baddie. but we're still gonna do it right. no skipping. let's go 🫢


✨ PROLOG

heads up, bestie: this manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ β€” so consult the corresponding Linux manual page for details on Linux behavior β€” or, plot twist, the interface may not be implemented on Linux at all. 😭


🌸 NAME

abs β€” return an integer absolute value. that's it. that's the whole job. iconic behavior honestly ✨


πŸŽ€ SYNOPSIS

#include <stdlib.h>

int abs(int i);

look at her. so clean. so simple. main character energy πŸ¦‹


πŸ’… DESCRIPTION

so, the functionality described on this reference page is aligned with the ISO C standard. And like β€” if there's any conflict between what's written here and the ISO C standard? that conflict is unintentional, fr fr. This volume of POSIX.1‐2017 defers to the ISO C standard. respect the hierarchy, periodt. πŸ‘‘

The abs() function shall compute the absolute value of its integer operand, i. πŸ’–

okay but listen β€” if the result cannot be represented, the behavior is undefined. undefined behavior is NOT cute, bestie. it's giving chaos. do not do this to yourself. πŸ’€

⭐ RETURN VALUE

The abs() function shall return the absolute value of its integer operand. like, that's the whole vibe check. in goes i, out comes the abs. πŸŽ€


πŸ™ˆ ERRORS

No errors are defined. she simply does not have problems. mentally stable queen. ✨

The following sections are informative β€” i.e. the vibes-only section, not the requirements section. iykyk.


🌈 EXAMPLES

None. πŸ’€

(sorry bestie. no examples. she's a minimalist. we respect it. 🫢)


🧚 APPLICATION USAGE

okay this one matters, so lean in πŸ‘‘

In two's-complement representation, the absolute value of the negative integer with the largest magnitude, {INT_MIN}, might not be representable. 😭

so like β€” that one specific value is out here living its truth and abs() literally cannot return it. be careful with that one. that's the drama. that's the whole drama. πŸ’…


πŸ’œ RATIONALE

None. πŸŽ€

(nothing to justify. she just is. iconic.)


πŸ¦‹ FUTURE DIRECTIONS

None. ⭐

(future? she's timeless.)


πŸ”₯ SEE ALSO

  • fabs()
  • labs()
  • The Base Definitions volume of POSIX.1‐2017, <stdlib.h>

go read those too, bestie, they're in the same friend group 🫢


okay legal time, stay with me, this is the realest part:

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. 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, babes πŸŽ€ IEEE/The Open Group, 2017 β€” the source and the version and the date, all in one lil' sign-off. ABS(3P) out. slay, stay safe, and don't you DARE call abs() on INT_MIN πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from