fmt_double(3)
okay bestie, grab your iced coffee because we're diving into fmt_double(3) from the Library Functions Manual. she's a whole vibe and she's about to write some doubles for you. no cap. π
π NAME π
fmt_double β she writes an ASCII representation of a double. that's it. that's the tweet. literally her entire purpose. periodt. π
β¨ SYNTAX β¨
first things first, you gotta include the header, bestie:
#include <libowfat/fmt.h>
and here's the function signature, copy it exactly or she will not answer:
size_t fmt_double(char *dest,double d,size_t maxlen,size_t prec);
π DESCRIPTION π
okay so boom. fmt_double writes an ASCII representation of d β and when I say ASCII, I mean '0' through '9', base 10, none of that hexadecimal nonsense β directly into dest. then she returns the number of bytes she actually wrote. so far so good? π«Ά
but wait, there's a limit. she will not write more than maxlen bytes. that's the rule. don't try to make her write more, she won't. π«
and she's precise, okay? she writes exactly prec digits. and if she has to, she'll use scientific notation. because sometimes that's just the mood. β¨
bestie, listen.fmt_doubledoes not append a\0. if you were expecting a null-terminated string, I'm so sorry, she's not that girl. you have to handle that yourself. π
one more thing β if dest equals FMT_LEN (i.e. it's zero), she doesn't write anything at all. instead she just tells you how many bytes she would have written. it's giving "window shopping". iconic. π
π SEE ALSO π
scan_double(3)β the matching read vibe. go say hi. π
mwah π this has been your bestie from the Library Functions Manual, fmt_double(3), signing off. stay precise, stay slay. β¨
π¦ where this page comes from
- alpine 3.24: libowfat-doc 0.34-r0 Β· GPL-2.0-only
- debian bookworm: libowfat-dev 0.32-4 Β· GPL-2.0-only
- debian trixie: libowfat-dev 0.32-5 Β· GPL-2.0-only
- nixos 26.05: libowfat 0.34
- nixpkgs unstable: libowfat 0.34
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- ubuntu noble: libowfat-dev 0.32-4.1build1 Β· GPL-2.0-only
- ubuntu questing: libowfat-dev 0.32-5
- ubuntu resolute: libowfat-dev 0.34-2 Β· GPL-2.0-only
- ubuntu stonking: libowfat-dev 0.34-2 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms