ROUND Function
The ROUND function rounds a number value to the number of decimal places you specify.
This function rounds up at values equal to or greater than 5 and down at values less than 5.
It takes two arguments, the numeric value you want rounded, and a "number of places" numeric value, which determines how many decimal places you want it rounded to. If you provide no "number of places" argument, it rounds it to the nearest integer.
Function name | ROUND |
Usage model | ROUND ( n:NUM, to places:NUM ) |
Parameters | This function requires you to replace two parameters: |
n: NUM |
The function rounds this value to a certain number of decimal places to places: NUM specifies. |
to places: NUM |
This value specifies the number of decimal places n: NUM rounds to. |
Result | A number value. |
Example
The following script would set nu2 to 16:
SET nu2 TO ROUND ( 15.5 )
This script would set nu2 to 15:
SET nu2 TO ROUND ( 15.4 )
This script would set nu2 to 16.02:
SET nu2 TO ROUND ( 16.019, 2 )