round

The function round( ) rounds a number to the number of decimals specified with the second parameter.

round ( input_number; number_of_decimals )

The result of this function is of type NUMBER; the rounded input_number.

The function has two parameters:

  1. input_number, type NUMBER. The number to be rounded.
  2. number_of_decimals, type NUMBER. The number of decimals the input_number must be rounded to. This is a value from 0 up to and including 9.
Rules for rounding

The function round( ) looks at the decimal number one place to the right of the allowed decimals. If this decimal is smaller than 5 the number is rounded down, when this decimal is 5 or higher the number is rounded up.

For example round( 12.334; 2 ) will have 12.33 as the result because two decimals are allowed. The third decimal is 4, this is below 5. So the number is rounded down: 12.33. round(12.335; 2) gives 12.34 because the third decimal, the decimal directly to the right of the allowed number of decimals, is 5., and 5 or higher is rounded up.

Example

@( round( 1223.535; 0 ) ) 

Result: 1,224.00

Note that the @( ) construction has its own rules for formatting numbers in the text. It uses a thousand separator and will always display two decimal positions. This format can be changed with the function Format.

Note that the construction @ ( ) around the function means that the result of the function is displayed in the text. This construction must be used in a text part of a model document. The switch from ITP mode to text mode in a model document is made with the # characters. An ITP model document starts in text model, the #BEGIN makes the switch to ITP mode.