Math Ceiling, Round and Floor Example

This following example demonstrates the ceiling, round and floor vipers.

Smartsite SXML CopyCode image Copy Code
{math.ceiling(0.6)} = 1
{math.floor(0.6)} = 0
{math.round(0.6)} = 1

{math.ceiling(0.6)} = 1
{math.floor(0.6)} = 0
{math.round(0.6)} = 1

{math.ceiling(0.4)} = 1
{math.floor(0.4)} = 0
{math.round(0.4)} = 0

{math.ceiling(5)} = 5
{math.floor(5)} = 5
{math.round(5)} = 5

{math.ceiling(5.1)} = 6
{math.floor(5.1)} = 5
{math.round(5.1)} = 5

{math.ceiling(-5.1)} = -5
{math.floor(-5.1)} = -6
{math.round(-5.1)} = -5

{math.ceiling(-5.9)} = -5
{math.floor(-5.9)} = -6
{math.round(-5.9)} = -6
Example Result CopyCode image Copy Code
1 = 1
0 = 0
1 = 1

1 = 1
0 = 0
1 = 1

1 = 1
0 = 0
0 = 0

5 = 5
5 = 5
5 = 5

6 = 6
5 = 5
5 = 5

-5 = -5
-6 = -6
-5 = -5

-5 = -5
-6 = -6
-6 = -6