C Language and Libraries Help (clang.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
_ecvt, _fcvt, _gcvt
 Summary Example                         Up Contents Index Back
─────Run-Time Library───────────────────────────────────────────────────────
 
     The _ecvt, _fcvt, and _gcvt functions convert a floating-point
     number to a character string. The <value> argument is the
     floating-point number to be converted. The _ecvt and _fcvt
     functions store up to <count> digits of <value> as a string and
     append a null character (\0). If the number of digits in <value>
     exceeds <count>, the low-order digit is rounded. If there are
     fewer than <count> digits, the string is padded with zeros.
 
     For _ecvt and _fcvt, only digits are stored in the string. The
     position of the decimal point and the sign of <value> can be
     obtained from <dec> and <sign> after the call. The <dec> argument
     points to an integer value giving the position of the decimal
     point with respect to the beginning of the string. A 0 or negative
     integer value indicates that the decimal point lies to the left of
     the first digit. The <sign> argument points to an integer
     indicating the sign of the converted number. If the integer value
     is 0, the number is positive; otherwise, it is negative.
 
     The _gcvt function converts a floating-point <value> to a
     character string (which includes a decimal point and a possible
     sign byte) and stores the string in <buffer>. The <buffer> should
     be large enough to accommodate the converted value plus a
     terminating null character (\0), which is appended automatically.
     If a buffer size of significant digits + 1 is used, the function
     will overwrite the end of the buffer. This is because the
     converted string includes a decimal point and can contain sign and
     exponent information. There is no provision for overflow.
 
     The _gcvt function produces <digits> significant digits. The
     output is in decimal format for values greater than or equal to
     0.1, and in exponential format for values less than 0.1. Trailing
     zeros may be suppressed in the conversion.
 
     The _ecvt and _fcvt functions use a single statically allocated
     buffer for the conversion. Each call to one of these routines
     destroys the result of the previous call.
 
     Return Value
 
     The functions return a pointer to the string of digits. There is
     no error return.
                                    -♦-