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, aNaNshall be returned. π - If x is
Β±0orΒ±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>
π 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. 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 ππ
π¦ 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