
FLOAT$ is a string function that can be used to convert standard IEEE 754 single precision (32 bits) floating point numbers into human-readable form. Any four consecutive bytes of a source array (which must be a byte array) can be converted. FLOAT$ requires four arguments as shown below:
1. Name of the source array.
2. Zero-based offset to the first byte of the floating point number.
3. Precision. Length of the fractional portion after the decimal point.
4. Mode. Set to 0 if source bytes are in little endian order, set to 1 if they are big endian.
This program shows FLOAT$ in action:
outmode -2 REM contains 12.34567 in normal and reverse order dim a(8) a(0) = 221 a(1) = 135 a(2) = 69 a(3) = 65 a(4) = 65 a(5) = 69 a(6) = 135 a(7) = 221 REM little endian offset 0 let f$ = float$ (a, 0, 6, 0) print f$ REM big endian offset 4 let f$ = float$ (a, 4, 6, 1) print f$
FLOAT$ new since version 4.58. FLOAT$ does not support exponential notation. If conversion cannot be performed e.g. if some argument is invalid, FLOAT$ sets LASTERR to ERR_REJECTED (12) or ERR_ARGUMENT (4). On success, LASTERR is set to ERR_OK (0).