Converts its argument to a null-terminated string of ASCII digits and returns the address of the string. Format #include <stdlib.h> char *gcvt (double value, int ndigit, char *buffer);
1 – Function Variants
The gcvt function has variants named _gcvt32 and _gcvt64 for use with 32-bit and 64-bit pointer sizes, respectively.
2 – Arguments
value An object of type double that is converted to a null-terminated string of ASCII digits. ndigit The number of ASCII digits to use in the converted string. If ndigit is less than 6, the value of 6 is used. buffer A storage location to hold the converted string.
3 – Description
The gcvt function places the converted string in a buffer and returns the address of the buffer. If possible, gcvt produces ndigit significant digits in F-format, or if not possible, in E-format. Trailing zeros are suppressed. The ecvt, fcvt, and gcvt functions represent the following special values specified in the IEEE Standard for floating-point arithmetic: Value Representation Quiet NaN NaNQ Signalling NaNS NaN +Infinity Infinity -Infinity -Infinity The sign associated with each of these values is stored into the sign argument. In IEEE floating-point representation, a value of 0 (zero) can be positive or negative, as set by the sign argument. See also fcvt and ecvt.
4 – Return Value
x The address of the buffer.