Decimals

Sets the number of decimal places to be used when displaying floating point numbers.

Syntax:

Decimals ( places )

Parameters:

(i) places: number of decimals to be displayed.

Returns:

(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.

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:

Example:


a=1.23456789
For d = 0 To 10
   Decimals(d)
   Message("Decimals = %d%", a)
Next
See Also:

<none>