The ceil()
function returns the nearest smallest double value that is greater than or equal to a number.
Figure 1 shows the mathematical representation of the ceil()
function.
double ceil(number num)
This function requires a number as a parameter.
The number can be
int
,float
,double
, orlong
.
ceil()
returns the nearest, smallest double value that is greater than or equal to a number sent as a parameter.
class JAVA {public static void main( String args[] ) {//integerSystem.out.println("Math.ceil(2):");System.out.println(Math.ceil(2));//positive double valueSystem.out.println("Math.ceil(2.56):");System.out.println(Math.ceil(2.56));//negative double valueSystem.out.println("Math.ceil(-2.36):");System.out.println(Math.ceil(-2.36));}}