Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom C Library Reference - <u>synopsis:</u> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Synopsis:
    #include <stdlib.h>
    char *gcvt( double value,
                int ndigits,
                char *buffer );
    char *_gcvt( double value,
                int ndigits,
                char *buffer );
    wchar_t *_wgcvt( double value,
                     int ndigits,
                     wchar_t *buffer );

Description:
    The gcvt function converts the floating-point number value into a
    character string and stores the result in buffer.  The parameter ndigits
    specifies the number of significant digits desired.  The converted
    number will be rounded to this position.

    If the exponent of the number is less than -4 or is greater than or
    equal to the number of significant digits wanted, then the number is
    converted into E-format, otherwise the number is formatted using
    F-format.

    The _gcvt function is identical to gcvt.  Use _gcvt for ANSI/ISO naming
    conventions.

    The _wgcvt function is identical to gcvt except that it produces a
    wide-character string (which is twice as long).

Returns:
    The gcvt function returns a pointer to the string of digits.

Example:
    #include <stdio.h>
    #include <stdlib.h>

    void main()
      {
        char buffer[80];

        printf( "%s\n", gcvt( -123.456789, 5, buffer ) );
        printf( "%s\n", gcvt( 123.456789E+12, 5, buffer ) );
      }

    produces the following:

    -123.46
    1.2346E+014

Classification:
    WATCOM

_gcvt conforms to ANSI/ISO naming conventions

Systems:
     gcvt - Math

    _gcvt - Math
    _wgcvt - Math

See Also:
    ecvt, fcvt, printf

See Also:

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson