Standards / Extensions | C or C++ | Dependencies |
---|---|---|
XPG4.2 |
both |
#define _XOPEN_SOURCE_EXTENDED 1
#include <stdlib.h>
char *fcvt(double x, int ndigit, int *__restrict__ decpt, int *__restrict__ sign);
The fcvt() function converts double floating-point argument values to floating-point output strings. The fcvt() function has been extended to determine the floating-point format (hexadecimal floating-point or IEEE Binary Floating-Point) of double argument values by using __isBFP().
z/OS® XL C/C++ formatted output functions, including the fcvt() function, convert IEEE Binary Floating-Point infinity and NaN argument values to special infinity and NaN floating-point number output sequences. See “fprintf Family of Formatted Output Functions” on fprintf(), printf(), sprintf() — Format and write data for a description of the special infinity and NaN output sequences.
The fcvt() function converts x to a NULL-terminated string which has ndigit digits to the right of the radix point (where the total number of digits in the output string is restricted by the precision of a double) and returns a pointer to the string. The function behaves identically to ecvt() — Convert double to string in all respects other than the number of digits in the return value.
If successful, fcvt() returns the character equivalent of x as specified above.
If unable to allocate the return buffer, or the conversion fails, fcvt() returns NULL.