EXPAND_NUMBER(3)
π EXPAND_NUMBER(3) β the libutil glow-up
okay bestie, so this is a page from the Library Functions Manual, and the function at the center of it all is expand_number β she takes a cute little human-readable string and turns it into a real actual number. main character energy fr fr.
β¨ NAME β¨
expand_number β format a number from human readable form π
π LIBRARY π
System Utilities Library (libutil, -lutil) π
πΈ SYNOPSIS πΈ
#include <libutil.h>
int
expand_number(const char *buf, uint64_t *num);
π« DESCRIPTION π«
so the expand_number() function parses the buf string and stores an unsigned 64-bit quantity at *num. that's it, that's the vibe. β¨
expand_number() is case-insensitive (she does not care about your capitalization choices, live your truth) and she follows the SI power of two convention. iykyk.
the suffixes are, and i cannot stress this enough, iconic:
Kβ kilo β1024Mβ mega β1048576Gβ giga β1073741824Tβ tera β1099511627776Pβ peta β1125899906842624Eβ exa β1152921504606846976
look at those numbers. enormous. so blessed. π₯
π«Ά RETURN VALUES π«Ά
upon successful completion, the value 0 is returned β slay π
otherwise, the value -1 is returned and the global variable errno is set to indicate the error. not the vibe, but she's honest about it. π
π ERRORS π
expand_number() will fail if:
[EINVAL]β the given string contains no digits. literally nothing to work with bestie, where are the numbers π₯²[EINVAL]β an unrecognized suffix was given. she does not know her, she does not recognize her π«[ERANGE]β result doesn't fit into 64 bits. too much woman for this container, the number simply outgrew the format π
π SEE ALSO π
humanize_number(3)β the reverse bestie, the other half of the duo π
π¦ HISTORY π¦
the expand_number() function first appeared in FreeBSD 6.3. a humble queen rising. π
and that's the whole page bestie!! this one came to you from Debian, dated July 20, 2019 β periodt, mwah ππβ¨
π¦ where this page comes from
- nixpkgs unstable: libutil 73
- Copyright (c) 2007 Eric Anderson <anderson@FreeBSD.org>
- Copyright (c) 2007 Pawel Jakub Dawidek <pjd@FreeBSD.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms