1gcvt(3) Library Functions Manual gcvt(3)
2
3
4
6 gcvt - convert a floating-point number to a string
7
9 Standard C library (libc, -lc)
10
12 #include <stdlib.h>
13
14 char *gcvt(double number, int ndigit, char *buf);
15
16 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
17
18 gcvt():
19 Since glibc 2.17
20 (_XOPEN_SOURCE >= 500 && ! (_POSIX_C_SOURCE >= 200809L))
21 || /* glibc >= 2.20 */ _DEFAULT_SOURCE
22 || /* glibc <= 2.19 */ _SVID_SOURCE
23 glibc 2.12 to glibc 2.16:
24 (_XOPEN_SOURCE >= 500 && ! (_POSIX_C_SOURCE >= 200112L))
25 || _SVID_SOURCE
26 Before glibc 2.12:
27 _SVID_SOURCE || _XOPEN_SOURCE >= 500
28
30 The gcvt() function converts number to a minimal length null-terminated
31 ASCII string and stores the result in buf. It produces ndigit signifi‐
32 cant digits in either printf(3) F format or E format.
33
35 The gcvt() function returns buf.
36
38 For an explanation of the terms used in this section, see at‐
39 tributes(7).
40
41 ┌────────────────────────────────────────────┬───────────────┬─────────┐
42 │Interface │ Attribute │ Value │
43 ├────────────────────────────────────────────┼───────────────┼─────────┤
44 │gcvt() │ Thread safety │ MT-Safe │
45 └────────────────────────────────────────────┴───────────────┴─────────┘
46
48 None.
49
51 Marked as LEGACY in POSIX.1-2001. POSIX.1-2008 removed it,
52 recommending the use of sprintf(3) instead (though snprintf(3) may be
53 preferable).
54
56 ecvt(3), fcvt(3), sprintf(3)
57
58
59
60Linux man-pages 6.05 2023-07-20 gcvt(3)