![]() |
VOOZH | about |
All methods of java.lang.StrictMath class : Set 1, Set 2
The java.lang.StrictMath.ceil() is an inbuilt method in Java is used to return the smallest double value, greater than or equal to the given double argument and equal to an integer. It gives rise to three special results:
Syntax:
public static double ceil(double num)
Parameters: The method accepts one parameter num of double type whose ceiling value is to be returned.
Return Value: The method returns the smallest floating-point value which is closest to negative infinity and is greater than or equal to the given argument and also equal to the integer.
Examples :
Input: num = 2.7 Output: 3.0 Input: num = -8.7 Output: -8.0
Below programs illustrate the java.lang.StrictMath.ceil() method:
Program 1:
The Ceil value of 8.7 = 9.0 The Ceil value of 7.1 = 8.0 The Ceil value of 3.5 = 4.0
Program 2:
The Ceil value of -8.7 = -8.0 The Ceil value of -7.1 = -7.0 The Ceil value of -3.5 = -3.0