Converts a floating point number to a string.
#include <prdtoa.h> PRStatus PR_dtoa( PRFloat64 d, PRIntn mode, PRIntn ndigits, PRIntn *decpt, PRIntn *sign, char **rve, char *buf, PRSize bufsz);
The function has these parameters:
dmodendigitsdecptsign*rveNULL this location is set to the address of the end of the result.bufbufszThe principle output is the null-terminated string stored in buf. If rve is not NULL, *rve is set to point to the end of the returned value.
This function converts the specified floating point number to a string, using the method specified by mode. Possible modes are:
0d when read in and rounded to nearest.12max(1, ndigits) significant digits. This gives a return value similar to that of ecvt, except that trailing zeros are suppressed.3ndigits past the decimal point. This gives a return value similar to that from fcvt, except that trailing zeros are suppressed, and ndigits can be negative.4,5,8,96-9all othersUpon return, the buffer specified by buf and bufsz contains the converted string. Trailing zeros are suppressed. Sufficient space is allocated to the return value to hold the suppressed trailing zeros.
If the input parameter d is+Infinity,-Infinity orNAN, *decpt is set to 9999.