]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/gcvt.3
eb345378f2e0e4094f8ff69e5c37ab2aa2c8a08a
[thirdparty/man-pages.git] / man3 / gcvt.3
1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
2 .\"
3 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
4 .\"
5 .\" References consulted:
6 .\" Linux libc source code
7 .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
8 .\" 386BSD man pages
9 .\" Modified Sat Jul 24 19:32:25 1993 by Rik Faith (faith@cs.unc.edu)
10 .TH GCVT 3 2021-03-22 "Linux man-pages (unreleased)" "Linux Programmer's Manual"
11 .SH NAME
12 gcvt \- convert a floating-point number to a string
13 .SH LIBRARY
14 Standard C library
15 .RI ( libc ", " \-lc )
16 .SH SYNOPSIS
17 .nf
18 .B #include <stdlib.h>
19 .PP
20 .BI "char *gcvt(double " number ", int " ndigit ", char *" buf );
21 .fi
22 .PP
23 .RS -4
24 Feature Test Macro Requirements for glibc (see
25 .BR feature_test_macros (7)):
26 .RE
27 .PP
28 .BR gcvt ():
29 .nf
30 Since glibc 2.17
31 (_XOPEN_SOURCE >= 500 && ! (_POSIX_C_SOURCE >= 200809L))
32 || /* Glibc >= 2.20 */ _DEFAULT_SOURCE
33 || /* Glibc <= 2.19 */ _SVID_SOURCE
34 Glibc versions 2.12 to 2.16:
35 (_XOPEN_SOURCE >= 500 && ! (_POSIX_C_SOURCE >= 200112L))
36 || _SVID_SOURCE
37 Before glibc 2.12:
38 _SVID_SOURCE || _XOPEN_SOURCE >= 500
39 .\" || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED
40 .fi
41 .SH DESCRIPTION
42 The
43 .BR gcvt ()
44 function converts \fInumber\fP to a minimal length null-terminated
45 ASCII string and stores the result in \fIbuf\fP.
46 It produces \fIndigit\fP significant digits in either
47 .BR printf (3)
48 F format or E format.
49 .SH RETURN VALUE
50 The
51 .BR gcvt ()
52 function returns
53 \fIbuf\fP.
54 .SH ATTRIBUTES
55 For an explanation of the terms used in this section, see
56 .BR attributes (7).
57 .ad l
58 .nh
59 .TS
60 allbox;
61 lbx lb lb
62 l l l.
63 Interface Attribute Value
64 T{
65 .BR gcvt ()
66 T} Thread safety MT-Safe
67 .TE
68 .hy
69 .ad
70 .sp 1
71 .SH STANDARDS
72 Marked as LEGACY in POSIX.1-2001.
73 POSIX.1-2008 removes the specification of
74 .BR gcvt (),
75 recommending the use of
76 .BR sprintf (3)
77 instead (though
78 .BR snprintf (3)
79 may be preferable).
80 .SH SEE ALSO
81 .BR ecvt (3),
82 .BR fcvt (3),
83 .BR sprintf (3)