1ECVT(3)                    Linux Programmer's Manual                   ECVT(3)
2
3
4

NAME

6       ecvt, fcvt - convert a floating-point number to a string
7

SYNOPSIS

9       #include <stdlib.h>
10
11       char *ecvt(double number, int ndigits, int *decpt, int *sign);
12
13       char *fcvt(double number, int ndigits, int *decpt, int *sign);
14

DESCRIPTION

16       The  ecvt()  function  converts  number  to a null-terminated string of
17       ndigits digits (where ndigits is reduced to  an  system-specific  limit
18       determined  by the precision of a double), and returns a pointer to the
19       string. The high-order digit is non-zero, unless number  is  zero.  The
20       low order digit is rounded.  The string itself does not contain a deci‐
21       mal point; however, the position of the decimal point relative  to  the
22       start  of  the  string is stored in *decpt. A negative value for *decpt
23       means that the decimal point is to the left of the start of the string.
24       If  the  sign  of number is negative, *sign is set to a non-zero value,
25       otherwise it's set to 0. If number is zero, it is  unspecified  whether
26       *decpt is 0 or 1.
27
28       The  fcvt() function is identical to ecvt(), except that ndigits speci‐
29       fies the number of digits after the decimal point.
30

RETURN VALUE

32       Both the ecvt() and fcvt() functions  return  a  pointer  to  a  static
33       string  containing  the  ASCII  representation  of  number.  The static
34       string is overwritten by each call to ecvt() or fcvt().
35

NOTES

37       These functions are obsolete. Instead, sprintf() is recommended.  Linux
38       libc4  and  libc5  specified  the  type  of ndigits as size_t.  Not all
39       locales use a point as the radix character (`decimal point').
40

CONFORMING TO

42       SVr2; marked as LEGACY in POSIX.1-2001.
43

SEE ALSO

45       ecvt_r(3), gcvt(3), qecvt(3), setlocale(3), sprintf(3)
46
47
48
49                                  1999-06-25                           ECVT(3)
Impressum