ECVT(3) Library Routines ECVT(3)
NAME
ecvt, fcvt - convert a floating-point number to a string
SYNOPSIS
#include <stdlib.h>
char *ecvt (double number, size_t ndigits, int *decpt, int *sign);
char *fcvt (double number, size_t ndigits, int *decpt, int *sign);
DESCRIPTION
The ecvt function converts number to a NULL terminated string of ndigā
its digits, and returns a pointer to the string. The string itself does
not contain a decimal point; however, the position of the decimal point
relative to the start of the string is stored in decpt. A negative
value for decpt means that the decimal point is to the left of the
start of the string. If the sign of number is negative, sign is set to
a non-zero value, otherwise it's set to 0.
The fcvt function is identical to ecvt, except that ndigits specifies
the number of digits after the decimal point.
RETURN VALUE
Both the ecvt and fcvt functions return a pointer to a static string
containing the ASCII representation of number. The static string is
overwritten by each call to ecvt or fcvt.
SEE ALSO
gcvt(3), sprintf(3)
GNO 15 September 1997 ECVT(3)
Man(1) output converted with
man2html