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
typecasting x to an integer.
For instance, (int)-2.5 is -2, but floor(-2.5) is -3.0.
- The fractional part of a number is returned by modf.
int a = floor(b);