roundup(3)
π roundup(3) β Library Functions Manual π
ok so bestie, welcome to roundup(3) β she lives in the Library Functions Manual section of your friendly neighborhood libc, and she is literally the girl who rounds things up. no cap. π
β¨ NAME β¨
roundup β round up in steps π
π LIBRARY π
Standard C library (libc) π«Ά
πΈ SYNOPSIS πΈ
#include <sys/param.h>
roundup(x, step);
π¦ DESCRIPTION π¦
okay so here's the vibe: this macro takes x and rounds it to the nearest multiple of step that is not less than x. it's giving glow-up but for numbers. β¨
and like, the typical situations where you'd call her? rounding up a pointer so it's aligned, or bumping a buffer size up so it's big enough to allocate. main character energy for memory stuff fr fr.
β οΈ but listen β this API is not designed to be generic, and there are some cases it just doesn't handle. and honestly? those cases aren't important for the typical use cases described above anyway. check CAVEATS below, iykyk. π
π RETURN VALUE π
this macro returns the rounded value. that's it, that's the tea. β
π STANDARDS π
None. bestie is built different, she's not on any standard. π
π CAVEATS π
- the arguments may be evaluated more than once. yes, more than once. protect them if they have side effects, bestie, seriously π
xshould be nonnegative, andstepshould be positive. fr fr, respect the range.- if
x + stepwould overflow or wrap around, the behavior is undefined. not "a little weird", not "probably fine" β undefined. do not test her. π¨
π SEE ALSO π
ceil(3), floor(3), lrint(3), rint(3), lround(3), round(3) β the whole rounding-up-and-down friend group, go say hi πΈ
that's the whole page, bestie!! you ate that. periodt. πβ¨π¦
this little icon was brought to you by Linux man-pages 6.20, dated 2025-05-17 β mwah, love you, bye ππ
π¦ where this page comes from
- 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 6.20
- π the page's license: Linux-man-pages-copyleft
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms