floor(var x): var
Rounds x down to the largest integer that is not greater than x; .
ceil(var x): var
Rounds x up to the smallest integer that is not smaller than x.
x - var to be rounded up or down.
x rounded up or down.
- The floor and ceil functions are not equivalent to converting x to an integer.
For instance, (int)-2.5 is -2, but floor(-2.5) is -3.0.
int a = floor(b);