The format is that used by the PRINT statement. Zero values are always formatted as “0”. Other values are formatted in simple decimal notation or in a scientific notation similar to FORTRAN “E” notation. Integers are always formatted in decimal notation, as are small floating point numbers. Single-precision values which cannot be represented in 7 digits because of the magnitude of the exponent and double-precision values which cannot be represented in 20 digits are formatted in scientific notation. Decimal notation is of the form “[-]ddddd” or “[-]ddd.ddd” if a fractional part exists. Scientific notation is of the form “[-]d.ddddE±dd” for single-precision and “[-]d.ddddD±dd” for double-precision values. The digits of the mantissa are formatted with docvt.
Docvt formats the numeric value given by type, generic (see generic(inc)). Docvt returns a pointer to a static area where the ASCII representation of the digits of the value’s mantissa are stored. The string contains no decimal point. Instead the position of the decimal point is stored in *pdecpt as an offset relative to the beginning of the string. If the value is negative, *psign is set to non-zero, and is set to zero otherwise. If eflag is set, a total of len digits are formatted. Otherwise all significant digits to the left of the decimal point plus len digits to the right, are formatted. The last digit is rounded. To avoid the implementation dependent issues of precision and round-off error in floating point numbers, ecvt and fcvt (see ecvt(3)) are used for the basic conversion.
These functions support other formatting functions and do not directly implement any BASIC functions.
from The Basmark QuickBASIC Programmer’s Manual by Lawrence Leinweber