ceil()
Returns the smallest integer value that is bigger than or equal to a given number. If you specify a digit after the decimal point, it rounds up from that digit. If the argument value is an integer, it returns the input as it is. This function takes only the numeric data type as an argument. If it received any other type, it returns null
.
Syntax
ceil(NUM_EXPR[, NUM_DIGITS])
Required Parameter
NUM_EXPR
- An expression that returns int, short, long, float, or double.
NUM_DIGITS
- Number of digits to which you want to round up the number. If you specify a negative number as
NUM_DIGITS
, the function rounds to the left of the decimal point.
Usage
json "{}" | eval ceiling=ceil(1.1) => 2
json "{}" | eval ceiling=ceil(1.6) => 2
json "{}" | eval ceiling=ceil(1.61, 1) => 1.7
json "{}" | eval ceiling=ceil(1.0) => 1
json "{}" | eval ceiling=ceil(5) => 5
json "{}" | eval ceiling=ceil(297.5, -2) => 300
json "{}" | eval ceiling=ceil("asdf") => null
json "{}" | eval ceiling=ceil("1.1") => null
json "{}" | eval ceiling=ceil(1.1, "eediom") => null