ROUND

ROUND rounds a float to an arbitrary number of decimal places. Default is 0 decimal places.

Function category: Statistical

Syntax

ROUND(arg1, arg2)

Arguments

Description

arg1

Array of values.

arg2

Optional. Number of decimal places that arg1 should be rounded.

Examples

Example 1: Round a value

Let's say we're given a response with the following vehicle information:

{
"trucks":{
"first":{
"driver_id":104,
"mpg":19.15
},
"second":{
"driver_id":104,
"mpg":25.19456
}
}
}

Using the default argument, which is 0, we could perform an operation using ROUND.

ROUND(trucks.first.mpg)

This returns the following, where the value before using the ROUND function for mpg is 19.15:

19

Example 2: Different number of decimal places

1 decimal place:

ROUND(trucks.first.mpg, 1)

This returns the following:

19.2

2 decimal places:

ROUND(trucks.first.mpg, 2)

This returns the following:

19.15

3 decimal places:

ROUND(trucks.second.mpg, 3)

This returns the following:

25.194

4 decimal places:

ROUND(trucks.second.mpg, 4)

This returns the following:

25.1946