Returns a number representing the largest value that is less than or equal to n.
Return value:
Returns a number representing the largest value that is less than or equal to n.
Example
import standard.C.math
class Main {
function Main() {
var y;
var n = 2.8;
var m = -2.8;
y = floor(n);
echo "The floor of 2.8 is " + y + "\n";
y = floor(m);
echo "The floor of -2.8 is " + y + "\n";
y = ceil(n);
echo "The ceil of 2.8 is " + y + "\n";
y = ceil(m);
echo "The ceil of -2.8 is " + y ;
}
}
Results
The floor of 2.8 is 2
The floor of -2.8 is -3
The ceil of 2.8 is 3
The ceil of -2.8 is -2