'\"macro stdmacro
.if n .pH g3c.ecvt @(#)ecvt	40.7 of 10/10/89
.\" Copyright 1989 AT&T
.nr X
.if \nX=0 .ds x} ecvt 3C "C Programming Language Utilities" "\&"
.if \nX=1 .ds x} ecvt 3C "C Programming Language Utilities"
.if \nX=2 .ds x} ecvt 3C "" "\&"
.if \nX=3 .ds x} ecvt "" "" "\&"
.TH \*(x}
.SH NAME
\f4ecvt\f1, \f4fcvt\f1, \f4gcvt\f1 \- convert floating-point number to string
.SH SYNOPSIS
.nf
\f4#include <stdlib.h>\f1
.PP
\f4char \(**ecvt (double value, int ndigit, int \(**decpt, int \(**sign);\fP
.PP
\f4char \(**fcvt (double value, int ndigit, int \(**decpt, int \(**sign);\fP
.PP
\f4char \(**gcvt (double value, int ndigit, char \(**buf);\fP
.SH DESCRIPTION
\f4ecvt\fP
converts 
.I value\^
to a null-terminated string of
.I ndigit\^
digits
and returns a pointer thereto.
The high-order digit is non-zero, unless the value is zero.
The low-order digit is rounded.
The position of the decimal point relative to the
beginning of the string is stored indirectly
through
.I decpt\^
(negative means to the left of the
returned digits). The decimal point is not
included in the returned string.
If the sign of the result is negative,
the word pointed to by
.IR sign ""
is non-zero, otherwise
it is zero.
.PP
\f4fcvt\fP
is identical to
\f4ecvt\f1,
except that the correct digit
has been rounded for \f4printf %f\fP
output of the number
of digits specified by
.IR ndigit .
.PP
\f4gcvt\fP
converts the
.I value\^
to a null-terminated string in
the array pointed to by
.I buf\^
and returns
.IR buf .
It attempts to produce
.I ndigit\^
significant digits in \f4%f\fP format if
possible, otherwise \f4%e\fP format (scientific notation), ready for
printing. A minus sign, if there is one, or a decimal point will be
included as part of the returned string.
Trailing zeros are suppressed.
.SH "SEE ALSO"
\f4printf\fP(3S).
.SH NOTES
The values returned by
\f4ecvt\fP
and
\f4fcvt\fP
point to a single static data array
whose content is overwritten by each call.
.\"	@(#)ecvt.3c	6.3 of 10/20/83
.Ee
