CEILING / CEIL

Calculates the smallest integer greater than the numeric expression given.

See also ROUND, FLOOR.

Syntax

CEILING( expr )

CEIL ( expr )

Arguments

Parameter

Description

expr

Numeric expression

Returns

When using the CEILING and CEIL floating point number scalar functions, real arguments are automatically cast to double precision.

Notes

  • If the input value is NULL, the result is NULL.

Examples

FLOOR vs. CEIL vs. ROUND

numbers=> SELECT FLOOR(x), CEIL(x), ROUND(x)
.      FROM (VALUES (0.0001), (-0.0001)
.           , (PI()), (-2.718281), (500.1234)) as t(x);
floor | ceil | round
------+------+------
    0 |    1 |    -0
    3 |    4 |     3
   -3 |   -2 |    -3
  500 |  501 |   500