eeccvvtt() -- General Function (libc)

Convert floating-point numbers to strings
cchhaarr *
eeccvvtt(_d, _p_r_e_c, _d_p, _s_i_g_n_p)
ddoouubbllee _d; iinntt _p_r_e_c, *_d_p, *ssiiggnnpp;

eeccvvtt()  converts  _d  into a  NUL-terminated  string  of  numerals with  the
precision of _p_r_e_c. Its operation resembles that of pprriinnttff()'s operator %ee.

eeccvvtt()  rounds the  last digit  and returns  a pointer  to the  result.  On
return, eeccvvtt() sets  _d_p to point to an integer  that indicates the location
of the decimal point relative to  the beginning of the string, to the right
if positive, to the left if negative.  It sets _s_i_g_n_p to point to an integer
that indicates the sign of _d, zero if positive and nonzero if negative.

_E_x_a_m_p_l_e
The following program demonstrates eeccvvtt(), ffccvvtt(), and ggccvvtt().

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

/* prototypes for extended functions */
extern char *ecvt();
extern char *fcvt();
extern char *gcvt();

main(void)
{
    char buf[64];
    double d;
    int i, j;
    char *s;

    d = 1234.56789;
    s = ecvt(d, 5, &i, &j);
    /* prints ecvt="12346" i=4 j=0 */
    printf("ecvt=\"%s\" i=%d j=%d\n", s, i, j);

    strcpy(s, fcvt(d, 5, &i, &j));
    /* prints fcvt="123456789" i=4 j=0 */
    printf("fcvt=\"%s\" i=%d j=%d\n", s, i, j);

    s = gcvt(d, 5, buf);
    /* prints gcvt="1234.56789" */
    printf("gcvt=\"%s\"\n", s);
}

_S_e_e _A_l_s_o
lliibbcc

_N_o_t_e_s
eeccvvtt() performs conversions within static string buffers that it overwrites
with each execution.
