:orphan: .. _ceiling: ************************** CEILING / CEIL ************************** Calculates the smallest integer greater than the numeric expression given. See also :ref:`ROUND`, :ref:`FLOOR`. Syntax ========== .. code-block:: postgres CEILING( expr ) CEIL ( expr ) Arguments ============ .. list-table:: :widths: auto :header-rows: 1 * - 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 =========== :ref:`floor` vs. ``CEIL`` vs. :ref:`round` ------------------------------------------------------------ .. code-block:: psql 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