ecvt_r(3)

✨ ecvt_r(3) ✨ β€” the <rainbow>convert a float to a string, but make it thread-safe-ish</rainbow> page

okay bestie, sit down, hydrate, because we're talking about ecvt_r(3) from the Library Functions Manual πŸ’–


🌸 NAME 🌸

ecvt_r, fcvt_r, qecvt_r, qfcvt_r β€” convert a floating-point number to a string πŸ’…

πŸ“š LIBRARY πŸ“š

Standard C library (libc, -lc) πŸŽ€


✨ SYNOPSIS ✨

#include <stdlib.h>

[[deprecated]] int ecvt_r(double number, int ndigits,
                          int *restrict decpt, int *restrict sign,
                          char *restrict buf, size_t size);
[[deprecated]] int fcvt_r(double number, int ndigits,
                          int *restrict decpt, int *restrict sign,
                          char *restrict buf, size_t size);

[[deprecated]] int qecvt_r(long double number, int ndigits,
                           int *restrict decpt, int *restrict sign,
                           char *restrict buf, size_t size);
[[deprecated]] int qfcvt_r(long double number, int ndigits,
                           int *restrict decpt, int *restrict sign,
                           char *restrict buf, size_t size);
πŸ‘€ notice the [[deprecated]] on literally every single one of these, bestie. the compiler is screaming at you. listen to it.

🧚 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):

ecvt_r(), fcvt_r(), qecvt_r(), qfcvt_r():
    /* glibc >= 2.19: */ _DEFAULT_SOURCE
        || /* glibc <= 2.19: */ _SVID_SOURCE || _BSD_SOURCE

πŸ’– DESCRIPTION πŸ’–

so like. ecvt_r(), fcvt_r(), qecvt_r(), and qfcvt_r() are identical to ecvt(3), fcvt(3), qecvt(3), and qfcvt(3) respectively β€” except for one lil glow-up: they do not return their result in a static buffer πŸ™ˆ. instead they use the buf you supply, which is size big. that's the whole vibe. go read ecvt(3) and qecvt(3) for the actual deets πŸ’«


🫢 RETURN VALUE 🫢

  • 0 β€” slay, success ✨
  • -1 β€” otherwise 😭

πŸ‘‘ ATTRIBUTES πŸ‘‘

for an explanation of the terms used in this section, see attributes(7).

  • Interface: ecvt_r(), fcvt_r(), qecvt_r(), qfcvt_r()
  • Attribute: Thread safety
  • Value: MT-Safe πŸ’…

πŸ“œ STANDARDS πŸ“œ

GNU. yeah. GNU. that's it. that's the standard.

πŸ’€ NOTES πŸ’€

okay so real talk: these functions are obsolete. like, they're giving "still works but everyone's side-eyeing you" energy. instead, sprintf(3) is recommended. periodt. πŸŽ€


🌈 SEE ALSO 🌈


okay that's the whole page, bestie, you ate that πŸ“πŸ’œ β€” this was Linux man-pages 6.20, dated 2026-02-08, and it's the ecvt_r(3) page, so go call sprintf(3) instead, ily, bye πŸ‘‘πŸ¦‹

πŸ“¦ where this page comes from
  • arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
  • nixpkgs unstable: man-pages 6.20
  • πŸ“œ the page's license: Linux-man-pages-copyleft
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms