CEIL(3P)
β¨ CEIL(3P) β¨ β the POSIX Programmer's Manual, but make it cute π
okay bestie, this is ceil(3P) from the POSIX Programmer's Manual β sit down, hydrate, we're learning math π
π¨ PROLOG π¨
so like, real talk first: this manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ β so if you're on Linux, go peek at the corresponding Linux manual page for the actual tea on Linux behavior π«. Or, plot twist, the interface might not even be implemented on Linux at all π. Not me finding this out the hard way.
πΈ NAME πΈ
ceil, ceilf, ceill β the ceiling value function β¨ (yes, like the ceiling of a room, but for numbers, and honestly iconic for it)
π¦ SYNOPSIS π¦
#include <math.h>
double ceil(double x);
float ceilf(float x);
long double ceill(long double x);
look at them. three little functions. all three of them are my babies π₯Ή
π DESCRIPTION π
The functionality described on this reference page is aligned with the ISO C standard. Any conflict between the requirements described here and the ISO C standard is unintentional β like, we didn't mean it bestie, it was an accident π₯Ί. This volume of POSIX.1β2017 defers to the ISO C standard. ISO C is the main character here, we're just the group chat.
So what do they actually do?? These functions shall compute the smallest integral value not less than x. That's it. That's the whole vibe. You give it a number, it rounds up to the nearest whole number. Always up, never down, no cap π.
π RETURN VALUE π
The result shall have the same sign as x. So if you fed it a negative, it stays negative. Sign integrity is preserved, periodt π .
Upon successful completion, ceil(), ceilf(), and ceill() shall return the smallest integral value not less than x, expressed as a type double, float, or long double, respectively. (Each one returns its own little type, matching its own little energy.)
- If x is
NaN, aNaNshall be returned. π NaN in, NaN out, that's the rule. - If x is
Β±0orΒ±Inf, x shall be returned. no notes, it just hands you back what you gave it π«Ά
π ERRORS π
No errors are defined. literally zero. no errors. the girls are unbothered β¨
The following sections are informative.
π EXAMPLES π
None. π i know. we're all a little disappointed. go write your own, you got this.
π§ APPLICATION USAGE π§
okay here's the important part, listen up π’
The integral value returned by these functions need not be expressible as an intmax_t. The return value should be tested before assigning it to an integer type, to avoid the undefined results of an integer overflow. like, do not just slam that thing into an int and walk away, bestie. test it first. undefined results are not a vibe, they're a menace π
These functions may raise the inexact floating-point exception if the result differs in value from the argument. lowkey just a heads up, don't panic πΈ
π RATIONALE π
None. the rationale is simply vibes. (no, seriously, there's nothing here.)
β FUTURE DIRECTIONS β
None. the future is bright but the directions are empty π
π₯ SEE ALSO π₯
feclearexcept()fetestexcept()floor()β the ceiling's sworn enemy, the one that rounds down. they're rivals, it's giving enemies to lovers πisnan()
Also, from the Base Definitions volume of POSIX.1β2017:
- 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 .
and that's the page bestie π«Ά brought to you by IEEE/The Open Group, 2017 β yeah, 2017, they were ahead of their time, we stan legacy documentation πβ¨π
π¦ where this page comes from
- alpine 3.22: man-pages-posix 2017a-r0 Β· custom
- alpine 3.23: man-pages-posix 2017a-r0 Β· custom
- alpine 3.24: man-pages-posix 2017a-r0 Β· custom
- arch rolling: man-pages 6.19-1
- arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages-posix 2017a
- opensuse-leap 16.0: man-pages-posix 2017a-160000.4.1 Β· SUSE-IEEE
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms