Skip to the content
Documentation

ceil

No ratings yet

Summary

Returns the next highest integer value of input or parameter.

Usage

input|ceil( value )

Parameters

Name Type Description Required
value number Value to be rounded up. Only if the input parameter is omitted.

Returns

Integer (rounded up version of input/parameter).

Description

This operator returns the next highest integer value by rounding up either the input or the "value" parameter. If both are provided, it is the "value" parameter that will be used.

Examples

Example 1
{1.5|ceil}

or

{ceil( 1.5 )}

The following output will be produced: "2".

Example 2
{5.5|ceil( 8.2 )}

The following output will be produced: "9".

Contributors

Comments (1 historical)

Written by readers of the earlier documentation sites, kept as they were.

  1. the return value of a ceil operator is actually double.

    Sergiy Pushchin ·

    Though it is rounded, it make it not possible to use value you get from ceil as an index for the arrays.
    like {$myarray[ceil(9|div(2))]} will result as an error.

Comments

Add a comment

Comments are read by a moderator before they appear.