Scalar Functions
Rounding functions
Learn how to use and combine different rounding functions in APL
Rounding functions
Function Name | Description |
---|---|
ceiling() | Calculates the smallest integer greater than, or equal to, the specified numeric expression. |
bin() | Rounds values down to an integer multiple of a given bin size. |
bin_auto() | Rounds values down to a fixed-size “bin”, with control over the bin size and starting point provided by a query property. |
floor() | Calculates the largest integer less than, or equal to, the specified numeric expression. |
ceiling()
Calculates the smallest integer greater than, or equal to, the specified numeric expression.
Arguments
- x: A real number.
Returns
- The smallest integer greater than, or equal to, the specified numeric expression.
Examples
bin()
Rounds values down to an integer multiple of a given bin size.
The bin()
function is used with summarize operator. If your set of values are disorderly, they will be grouped into fractions.
Arguments
- value: A date, number, or timespan
- roundTo: The “bin size”, a number or timespan that divides value.
Returns
The nearest multiple of roundTo below value.
Examples
bin_auto()
Rounds values down to a fixed-size “bin”, the bin_auto()
function can only be used with the summarize operator by statement with the _time
column.
Arguments
- Expression: A scalar expression of a numeric type indicating the value to round.
Returns
The nearest multiple of query_bin_auto_at
below Expression, shifted so that query_bin_auto_at
will be translated into itself.
Example
floor()
Calculates the largest integer less than, or equal to, the specified numeric expression.
Arguments
- number: A real number.
Returns
- The largest integer greater than, or equal to, the specified numeric expression.