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
- Copyright 2002, Andries E. Brouwer <aeb@cwi.nl>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms