Computer Applications
Predict the output of the following:
System.out.println(Math.ceil(-0.95));
Java
Java Math Lib Methods
42 Likes
Answer
-0.0
Working
Math.ceil method returns the smallest double value that is greater than or equal to the argument and is equal to a mathematical integer. If the argument value is less than zero but greater than -1.0, then the result is negative zero which is the case in this question.
Answered By
23 Likes
Related Questions
Predict the output of the following:
System.out.println(Math.max(-77.66, -87.45));
Predict the output of the following:
System.out.println(Math.min(-25.5, -12.5));
Predict the output of the following:
System.out.println(Math.cbrt(42.875));
Predict the output of the following:
System.out.println(Math.round(-18.51));