Skip to content
This repository has been archived by the owner on Oct 7, 2024. It is now read-only.
Dan Gorman edited this page Nov 29, 2018 · 2 revisions

The ROUND Function

Function Group: Statistical

ROUND rounds a float to an arbitrary number of decimal places, defaulting to 0 decimal places.

Syntax

ROUND(arg1, arg2)

  • arg1 is an array of values
  • arg2 is optional, and refers to the number of decimal places that arg1 should be rounded to.

Uses

Let's say we're given a response with some vehicle information that looks like this:

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

Using the default argument, we could perform an operation like this:

ROUND(trucks.first.mpg)

This returns 19.

Other examples:

ROUND(trucks.first.mpg, 1) = > 19.2

ROUND(trucks.first.mpg, 2) = > 19.15

ROUND(trucks.first.mpg, 3) = > 19.15

ROUND(trucks.second.mpg, 4) = > 25.1946

Clone this wiki locally