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