Round

Function

Round(value)

value

Round(value, digits)

value
digits

Use

The Round() function returns a number rounded to a given decimal point. It will round the number up or down appropriately.

If nothing is provided for the decimal point, 0 is assumed.

The number result given by Round() is a new number stored at that value, as opposed to rounding with value formatting, which only changes how a number is displayed.

Round() treats rounding up as rounding away from 0. For example, Round(-7.9)  = -8 and Round(-7.2)  = -7.

Units

Numbers with units will be rounded based on those units. This means that the unit a number has at the point of calculation will affect the answer.

For example, Round(5.8ft) and Round(5.8 ft to mm) will return values that are not equal.

Examples
  • Round(1.8)  = 2
  • Round(1.2)  = 1
  • Round(-1.8)  = -2
  • Round(1.8888, 2)  = 1.89
  • Round(1.8888, 3)  = 1.889
  • Round(45183.1, -2)  = 45200
  • Round(3.2 ft)  = 3ft
  • Round(3.2 ft to cm)  = 98cm
  • Round(3.2 ft to cm) to ft  = 3.215 ft
Related functions

 

 


Round is included by default in each file as part of the Math library.

 

See also: