ceiling function to round a numeric value up to the smallest integer greater than or equal to the input. This function is useful when you need to ensure that fractional values always round up, such as when calculating resource allocations, pagination counts, or bucket sizes.
Use ceiling when you want to convert decimal numbers to whole numbers by rounding up. For example, if you have 7.2 requests per second and need to provision whole server instances, ceiling ensures you allocate 8 instances rather than 7.
For users of other query languages
If you come from other query languages, this section explains how to adjust your existing queries to achieve the same results in APL.Splunk SPL users
Splunk SPL users
In Splunk SPL, you use the
ceil or ceiling function to round up values. APL’s ceiling function works the same way.ANSI SQL users
ANSI SQL users
In ANSI SQL, the
CEILING or CEIL function performs the same operation. APL’s syntax is nearly identical.Usage
Syntax
Parameters
| Name | Type | Description |
|---|---|---|
number | real | The numeric value to round up. |
Returns
An integer representing the smallest whole number greater than or equal to the input value.Use case examples
- Log analysis
- OpenTelemetry traces
Round request durations up to whole milliseconds for consistent bucketing.QueryRun in PlaygroundOutput
This query groups requests into 100ms buckets using
| duration_bucket | request_count |
|---|---|
| 100 | 1250 |
| 200 | 3420 |
| 300 | 2180 |
| 400 | 890 |
ceiling to ensure all fractional durations round up to the next bucket boundary.List of related functions
- floor: Rounds down to the largest integer less than or equal to the input. Use
ceilingwhen you need to round up instead. - bin: Rounds values down to a multiple of a specified bin size. Use
ceilingfor simple upward rounding to integers. - round: Rounds to the nearest integer or specified precision. Use
ceilingwhen you always need to round up.