/usr/ucb/cc [flag . . . ] file . . .#include <fp.h>
char *econvert(double value, int ndigit, int *decpt, int *sign, char *buf);
char *fconvert (double value, int ndigit, int *decpt, int *sign, char *buf);
char *gconvert(double value, int ndigit, int trailing, char *buf);
char *seconvert(single *value, int ndigit, int *decpt, int *sign, char *buf);
char *sfconvert(single *value, int ndigit, int *decpt, int *sign, char *buf);
char *sgconvert(single *value, int ndigit, int trailing, char *buf);
fconvert works much like econvert, except that the correct digit has been rounded as if for sprintf(%w.nf) output with n=ndigit digits to the right of the decimal point. ndigit can be negative to indicate rounding to the left of the decimal point. The return value is a pointer to buf. buf should contain at least 310+max(0, ndigit) characters to accommodate any double-precision value.
gconvert converts the value to a NULL-terminated ASCII string in buf and returns a pointer to buf. It produces ndigit significant digits in fixed-decimal format, like sprintf(%w.nf), if possible, and otherwise in floating-decimal format, like sprintf(%w.ne); in either case buf is ready for printing, with sign and exponent. The result corresponds to that obtained by
(void) sprintf(buf,``%w.ng'',value) ;
If trailing= 0, trailing zeros and a trailing point are suppressed, as in sprintf(%g). If trailing!= 0, trailing zeros and a trailing point are retained, as in sprintf(%#g).
seconvert, sfconvert, and sgconvert are single-precision versions of these functions, and are more efficient than the corresponding double-precision versions. A pointer rather than the value itself is passed to avoid C's usual conversion of single-precision arguments to double.
IEEE Infinities and NaNs are treated similarly by these functions. NaN is returned for NaNs, and Inf or Infinity for Infinities. The longer form is produced when ndigit is at least 8.
Note: Most applications should use sprintf [see fprintf(3S)], strtod(3C) and strtold [see strtod(3C)] instead of these functions.