FLOAT [ HP Business BASIC/XL Reference Manual ] MPE/iX 5.0 Documentation
HP Business BASIC/XL Reference Manual
FLOAT
The FLOAT statement sets the default numeric output format to
floating-point and specifies the number of digits to be printed to the
right of the decimal point. The FIXED and STANDARD statements also set
the default numeric output format.
Syntax
FLOAT num_expr
Parameters
num_expr Its rounded value, n, must be in the short integer
range. When HP Business BASIC/XL outputs a number in
fixed-point format, it prints n digits to the right of
the decimal point. If n is less than one, HP Business
BASIC/XL prints no decimal point and no decimal digits.
If n is greater than 16, HP Business BASIC/XL prints 16
decimal digits.
Floating-point format is appropriate for very large and very small
numbers. Floating-point format is
{+}
[-]d[[d]...]E {-}dd[d]
where d is a numeric digit. The leftmost minus sign prints if the number
is negative. The decimal point prints unless n is zero, and it is
followed by n digits. To express the number in fixed-point format, raise
ten to the power of the exponent (represented by {+|-}dd[d]) and multiply
it by the mantissa (represented by [-]d[.d[d]...]).
Examples
10 FLOAT 2
20 PRINT 123;.4567;-79810;-1.235E+47
99 END
The above program prints:
1.23E+02 4.57E-01 -7.98E+04 -1.24E+47
If line 10 is changed to
10 FLOAT 3
then the program prints:
1.230E+02 4.567E-01 -7.981E+04 -1.235E+47
MPE/iX 5.0 Documentation