Copyright © tutorialspoint.com
The method ceil gives the smallest integer that is greater than or equal to the argument.
This method has following variants:
double ceil(double d) double ceil(float f) |
Here is the detail of parameters:
A double or float primitive data type
Returns the smallest integer that is greater than or equal to the argument. Returned as a double.
public class Test{ public static void main(String args[]){ double d = -100.675; float f = -90; System.out.println(Math.ceil(d)); System.out.println(Math.ceil(f)); System.out.println(Math.floor(d)); System.out.println(Math.floor(f)); } } |
This produces following result:
-100.0 -90.0 -101.0 -90.0 |
Copyright © tutorialspoint.com