Skip to main content

round

round ( round : number, places : integer) : number

ParameterTypeDescription
aRoundnumber->Number to be rounded
placesinteger->Number of decimal places used for rounding
Resultnumber<-Number rounded to the number of decimal places specified by places

Description

round returns number rounded to the number of decimal places specified by places.

If places is positive, number is rounded to places decimal places. If places is negative, number is rounded on the left of the decimal point.

If the digit following places is 5 though 9, round rounds toward positive infinity for a positive number, and toward negative infinity for a negative number. If the digit following places is 0 through 4, round rounds toward zero.

Example

The following example illustrates how round works with different arguments:

 var vlResult : number
vlResult = round(16.857,2) // vlResult gets 16.86
vlResult = round(32345.67,-3) // vlResult gets 32000
vlResult = round(29.8725,3) // vlResult gets 29.873
vlResult = round(-1.5,0) // vlResult gets –2

See also

trunc