kstrtoudec64(9)
π kstrtoudec64 π
okay so bestie, welcome to kstrtoudec64 β the little kernel helper that takes a string and turns it into an unsigned 64-bit scaled decimal value. yes, that's the whole vibe. it's from the Kernel API Manual and honestly it ate. β¨
πΈ SYNOPSIS πΈ
int kstrtoudec64 (const char *s , unsigned int scale , u64 *res );
like, three args, no drama, she's lowkey iconic for that π«Ά
π ARGUMENTS π
sβ the start of the string, bestie. it must be null-terminated, and it may also include a single newline before its terminating null (just the one, okay? don't get weird with it π). the first character may also be a plus sign β but not a minus sign. nope. no negatives here, this is unsigned erasure πscaleβ the number of digits to the right of the decimal point. that's it, that's the whole job β¨resβ where the result of the conversion gets written on success. it's the lil home for your answer π π
π¦ DESCRIPTION π¦
okay so let's do the example, because the example eats:
a scale of 3 with input "123.45" results in 123450. iconic. no cap. π₯
and here's the tea: trailing zeros in the fractional part of the input, the ones you'd need to match the scale? not required. she's chill like that. π§
also β digits beyond the specified scale are ignored. literally just not invited to the party π ββοΈ
π RETURN π
0on success β slay π-ERANGEon overflow β she got too big for her boots π-EINVALon parsing error β the string showed up not knowing the assignment π
π SEE ALSO π
- Kernel file
./lib/kstrtox.c _parse_integer_limit(9)kstrtoull(9)kstrtoll(9)kstrtouint(9)kstrtoint(9)kstrtobool(9)kstrtodec64(9)
go read them, iykyk πβ
and that's the page, bestie π this one lives under ./lib, dated October 2026, and it's part of the Kernel API Manual β periodt. ππ¦πΈ
π¦ 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