kstrtodec64(9)
π kstrtodec64(9)
okay bestie, welcome to the Kernel API Manual β¨ today we're looking at kstrtodec64 and honestly? she's iconic. this one converts a string into a signed 64-bit scaled decimal value and she does it flawlessly, no cap π«Ά
β¨ NAME β¨
kstrtodec64 β Convert a string to a signed 64-bit scaled decimal value. literally her whole personality π
πΈ SYNOPSIS πΈ
int kstrtodec64 (const char *s , unsigned int scale , s64 *res );
π ARGUMENTS π
sβ the start of the string, bestie. she must be null-terminated, and she's also allowed to have a single newline sitting right before that terminating null (yes she's flexible like that πββοΈ). the very first character can also be a plus sign or a minus sign, so go off king πscaleβ the number of digits to the right of the decimal point. this is her main character number fr π₯resβ where the result of the conversion gets written when everything goes right. this is the spot where the slay gets delivered π
π¦ DESCRIPTION π¦
okay so picture this: a scale of 4 with the input "-3.141592" gives you -31415. that's it, that's the vibe β¨
and listen β digits beyond the specified scale are ignored π like, they simply don't make the cut. also, you do not need to pad in trailing zeros in the fractional part just to match the scale. she's low-maintenance, she's chill, she ate π
β RETURN β
0on success π-ERANGEon overflow π-EINVALon parsing error π
like, three outcomes and she's honest about all of them. we love a transparent queen π
π SEE ALSO π
- Kernel file
./lib/kstrtox.c _parse_integer_limit(9)kstrtoull(9)kstrtoll(9)kstrtouint(9)kstrtoint(9)kstrtobool(9)kstrtoudec64(9)
the whole friend group!! go say hi to her sisters, they're all serving π
ngl bestie, if you're passing a string that isn't null-terminated, or you've got more than one sneaky newline chilling at the end, that's on you. the rules are the rules π
and that's the whole page, bestie!! this one lives in ./lib, dated October 2026, and she goes by kstrtodec64(9) π mwah, go convert something iconic π§ββοΈβ¨
π¦ 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