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, a NaN shall be returned. πŸ™ˆ NaN in, NaN out, that's the rule.
  • If x is Β±0 or Β±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>

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