FLOOR(3POSIX)

✨ hey bestie, welcome to floor(3POSIX) ✨

okay so this lil page is from the POSIX Programmer's Manual (yes, the whole Programmer's Manual, it's giving official πŸ‘‘). Quick heads-up before we dive in, no cap: the Linux implementation of this interface may differ from what's written here (so like, go check the corresponding Linux manual page for the deets on Linux behavior), or honestly the interface may not even be implemented on Linux at all. πŸ™ˆ


🌸 PROLOG 🌸

This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the corresponding Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux. πŸ’…


πŸ’– NAME πŸ’–

floor, floorf, floorl β€” the floor function, aka the "round down bestie" of the math world πŸ¦‹


✨ SYNOPSIS ✨

#include <math.h>

double floor(double x);
float floorf(float x);
long double floorl(long double x);

πŸŽ€ DESCRIPTION πŸŽ€

So the functionality described on this reference page is aligned with the ISO C standard. If there's any conflict between the requirements described here and the ISO C standard, that conflict is unintentional β€” not on purpose, swear 😭. This volume of POSIX.1‐2017 defers to the ISO C standard, periodt.

These functions shall compute the largest integral value not greater than x. That's it. That's the whole vibe. ⬇️


πŸ”₯ RETURN VALUE πŸ”₯

The result shall have the same sign as x. iykyk.

Upon successful completion, these functions shall return the largest integral value not greater than x, expressed as a double, float, or long double, as appropriate for the return type of the function. Slay, type-correct king πŸ‘‘

  • If x is NaN, a NaN shall be returned. πŸ’€
  • If x is Β±0 or Β±Inf, x shall be returned. (it just hands it right back to you, no notes 🫢)

🧚 ERRORS 🧚

No errors are defined. Literally none. We're unproblematic. ✨

The following sections are informative β€” meaning they're the bonus content, not the rules, bestie.


πŸ’œ EXAMPLES πŸ’œ

None. Nada. The examples section said "not me being empty" πŸ™ˆ


🌈 APPLICATION USAGE 🌈

okay this part matters, listen up:

  • The integral value returned by these functions might not be expressible as an intmax_t. So you should test the return value before assigning it to an integer type, or you'll get the undefined results of an integer overflow. That's the undefined behavior jumpscare, do not skip this step 😭
  • These functions may raise the inexact floating-point exception if the result differs in value from the argument. (just a lil heads up, not a crisis πŸ’…)

⭐ RATIONALE ⭐

None. The rationale said "no thoughts, head empty" πŸŽ€


πŸ¦‹ FUTURE DIRECTIONS πŸ¦‹

None. The future is bright and also empty. ✨


πŸ‘‘ SEE ALSO πŸ‘‘

  • ceil()
  • feclearexcept()
  • fetestexcept()
  • isnan()
  • Section 4.20, Treatment of Error Conditions for Mathematical Functions, <math.h>

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 .


okay that's the whole page bestie, you ate that πŸ’…βœ¨ and for the cute sign-off: this iconic little number was brought to you by IEEE/The Open Group, dated 2017 β€” FLOOR(3POSIX), and that's on periodt πŸŽ€πŸ’–