Sets the number of decimal places to be used when displaying floating point numbers.
Decimals ( places )
(i) places: number of decimals to be displayed.
(i) previously set value.
Use this function to set the number of decimal places to be displayed when viewing a floating point number. The floating point number will be rounded to the specified number of decimals. If you require special formatting, use the following:
Special Formatting (places):
-3 |
Always use scientific format |
-2 |
Use alternate method of converting to strings, with no trailing zeros |
-1 |
Full precision, dropping of trailing zeros. |
2 |
Computations on US currency -- mortgage or financial calculations |
Note: The Decimals function only affects a floating point number when it gets converted to a string. This includes:
Using variable substitution.
Any string function is used.
Dialog or Message box.
Passed as a string parameter to any function.
a=1.23456789 For d = 0 To 10 Decimals(d) Message("Decimals = %d%", a) Next
<none>