what will Math. sqrt(-9)return in java
Answers
Answered by
7
Math.sqrt() method - Java
Java provides various classes and methods for easy use in programs. The Math class is one of them.
The Math class has various mathematical methods. The Math.sqrt() returns the square root of the number. The function signature is like this:
public static double sqrt(double num)
This method returns the square root of a positive double number.
In case the parameter num is Not a Number (NaN) or is negative, the function will return NaN.
So, Math.sqrt(-9) will return NaN (Not a Number).
Attachments:
Similar questions