StrictMath.ceil(): This method is available in java.lang.StrictMath class of Java.
Syntax:
double java.lang.StrictMath.ceil(double a)
This method takes one argument of type double as its parameter. This method returns the smallest (closest to negative infinity) double value that is greater than or equal to the argument and is equal to a mathematical integer.
Special cases:
1. If the argument value is already equal to a mathematical integer, then the result is the same as the argument.
2. If the argument is NaN or an infinity or positive zero or negative zero, then the result is the same as the argument.
3. If the argument value is less than zero butgreater than -1.0, then the result is negative zero.
Parameters: One parameter is required for this method.
a: a value.
Returns: the smallest (closest to negative infinity)floating-point value that is greater than or equal to the argument and is equal to a mathematical integer.
Exceptions: NA
Approach
Java
public class StrictMathceil {public static void main(String[] args) {double a = -178.89;System.out.println(StrictMath.ceil(a));}}
Output:
-178.0
No comments:
Post a Comment