1gcvt(3)                    Library Functions Manual                    gcvt(3)
2
3
4

NAME

6       gcvt - convert a floating-point number to a string
7

LIBRARY

9       Standard C library (libc, -lc)
10

SYNOPSIS

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

DESCRIPTION

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

RETURN VALUE

35       The gcvt() function returns buf.
36

ATTRIBUTES

38       For  an  explanation  of  the  terms  used  in  this  section,  see at‐
39       tributes(7).
40
41       ┌────────────────────────────────────────────┬───────────────┬─────────┐
42Interface                                   Attribute     Value   
43       ├────────────────────────────────────────────┼───────────────┼─────────┤
44gcvt()                                      │ Thread safety │ MT-Safe │
45       └────────────────────────────────────────────┴───────────────┴─────────┘
46

STANDARDS

48       None.
49

HISTORY

51       Marked as LEGACY in POSIX.1-2001.  POSIX.1-2008 removed it,  recommend‐
52       ing  the  use  of sprintf(3) instead (though snprintf(3) may be prefer‐
53       able).
54

SEE ALSO

56       ecvt(3), fcvt(3), sprintf(3)
57
58
59
60Linux man-pages 6.04              2023-03-30                           gcvt(3)
Impressum