The java.lang.Math.sqrt() returns the square root of a value of type double passed to it as argument. If the argument is NaN or negative, then the result is NaN. If the argument is positive infinity, then the result is positive infinity. If the argument passed is positive zero or negative zero then the result will be same as that of the argument.
public static double sqrt(double a) Parameter : a : the value whose square root is to be returned. Return : This method returns the positive square root value of the argument passed to it.
Example 1: To show working of java.lang.Math.sqrt() method.
5.477225575051661 6.708203932499369 7.745966692414834 9.486832980505138
Example 2: To show working of java.lang.Math.sqrt() method when argument is NaN or +infinity.
NaN Infinity NaN
- BigDecimal sqrt() Method in Java with Examples
- BigInteger sqrt() Method in Java
- StrictMath sqrt() Method in Java
- Java Guava | sqrt(long x, RoundingMode mode) of LongMath Class with Examples
- Java Guava | sqrt(int x, RoundingMode mode) method of IntMath Class
- BigIntegerMath sqrt() function | Guava | Java
- Java lang.Long.numberOfTrailingZeros() method in Java with Examples
- Java lang.Long.reverse() method in Java with Examples
- Java lang.Long.builtcount() method in Java with Examples
- Java lang.Long.byteValue() method in Java with Examples
- Java lang.Long.lowestOneBit() method in Java with Examples
- Java.util.Collections.rotate() Method in Java with Examples
- Java.util.Collections.disjoint() Method in java with Examples
- Java.lang.Short toString() method in Java with Examples
- Java lang.Long.highestOneBit() method in Java with Examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.