ICSE Class 9 Computer Applications
Question 2 of 16
Mathematical Library Methods — Question 2
Back to all questions 2
Question Question 2
Explain the following Math functions in Java:
i. Math.sqrt()
Returns the square root of its argument as a double value. For example, Math.sqrt(25) will return 5.0.
ii. Math.cbrt()
Returns the cube root of its argument as a double value. For example, Math.cbrt(27) will return 3.0.
iii. Math.random()
Returns a positive double value, greater than or equal to 0.0 and less than 1.0.
iv. Math.round()
Rounds off its argument to the nearest mathematical integer and returns its value as an int or long type. If argument is float, return type is int, if argument is double, return type is long. At mid-point, it returns the higher integer. For example, Math.round(2.5) will return 3.