Var round

From Sim Innovations Wiki
Jump to navigation Jump to search

Description

value = var_round(value,decimals)

var_round is used to round a number to a certain number of decimals

Return value

Argument Type Description
value Number Return rounded value.

Arguments

# Argument Type Description
1 value Number The is the value that needs to be rounded
2 decimals Number The number of decimals the value should get.

Example

-- Returns 1
myvalue = var_round(1.12345,0)

-- Returns 1.1
myvalue = var_round(1.12345,1)

-- Returns 1.12
myvalue = var_round(1.12345,2)

-- Returns 1.2 (note that var_round rounds to the nearest value)
myvalue = var_round(1.16789,1)

-- Returns 1.16789
myvalue = var_round(1.16789,100)