DIV_U64_ROUND_CLOSEST(9)
β¨ DIV_U64_ROUND_CLOSEST π
okay bestie, welcome to the Kernel API Manual πΈ and today's main character is DIV_U64_ROUND_CLOSEST β literally the "divide a big unsigned number by a smaller unsigned number and round it nicely" girlie. no cap, she's iconic and she's about to make ur math cute π
π¦ NAME
DIV_U64_ROUND_CLOSEST β unsigned 64bit divide with 32bit divisor rounded to nearest integer β¨
like... big number, small number, fancy rounding. that's the whole vibe π
π«Ά SYNOPSIS
DIV_U64_ROUND_CLOSEST (dividend , divisor );
(yeah the spacing is a little weird, she's quirky like that, don't @ her π)
π ARGUMENTS
dividendβ the unsigned 64bit dividend π lowkey the big one, the star of the showdivisorβ the unsigned 32bit divisor π¦ the smol one doing the dividing, we love her
π DESCRIPTION
Divide unsigned 64bit dividend by unsigned 32bit divisor and round to closest integer.
that's it, that's the whole thing. big number Γ· smol number, but instead of just chopping the decimal off, she rounds to whichever integer is closest. it's giving "best of both worlds", it's giving "attention to detail" π no truncation erasure here π
β RETURN
dividend / divisor rounded to nearest integer π
so like, the answer comes back all clean and integer-y, already rounded for u, no extra work required. slay β¨
π SEE ALSO
she lives in the kernel file ./include/linux/math64.h π and honestly she runs with a whole squad, so go say hi to:
div_u64_rem(9)div_s64_rem(9)div64_u64_rem(9)div64_s64_rem(9)div64_u64(9)div64_s64(9)div_u64(9)div_s64(9)mul_u64_add_u64_div_u64(9)mul_u64_u64_div_u64(9)mul_u64_u64_div_u64_roundup(9)DIV64_U64_ROUND_UP(9)DIV_U64_ROUND_UP(9)DIV64_U64_ROUND_CLOSEST(9)DIV_S64_ROUND_CLOSEST(9)roundup_u64(9)
fr fr go read the whole squad, they're all in the same math64.h friend group πΈ
k that's the whole page bestie, hope the rounding math is giving everything u needed π β¨
source: ./include/linux Β· version: October 2026 Β· mwah, catch u in the next manpage π«Άππ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms