COHERENT manpages

This page displays the COHERENT manpage for gcvt() [Convert floating-point numbers to strings].

List of available manpages
Index


gcvt() -- General Function (libc)

Convert floating-point numbers to strings
char *
gcvt(d, prec, buffer)
double d; int prec; char *buffer;

gcvt() converts floating-point  number d into a NUL-terminated string.  Its
operation resembles that of printf()'s operator %g.

Argument  prec  gives the  precision  of  the string  i.e.,  the number  of
numerals to the right of the  decimal point.  Unlike its cousins ecvt() and
fcvt(), gcvt()  uses a buffer that  is defined by the  caller.  buffer must
point  to a  buffer large  enough to  hold the  result; 64  characters will
always be sufficient.  When  generating its output, gcvt() mimics fcvt() if
possible.  Otherwise, it mimics ecvt().

gcvt returns buffer.

Example

For an example of this function, see the entry for ecvt().

See Also

libc