The java.lang.Math.pow() is used to calculate a quantity elevate to the facility of another quantity. This perform accepts two parameters and returns the worth of first parameter raised to the second parameter. There are some particular circumstances as listed beneath:
- If the second parameter is constructive or detrimental zero then the result might be 1.0.
- If the second parameter is 1.0 then the result might be similar as that of the primary parameter.
- If the second parameter is NaN then the result will even be NaN.
Attention reader! Don’t cease studying now. Get maintain of all of the essential Java Foundation and Collections ideas with the Fundamentals of Java and Java Collections Course at a student-friendly value and grow to be trade prepared. To full your preparation from studying a language to DS Algo and plenty of extra, please refer Complete Interview Preparation Course .
public static double pow(double a, double b) Parameter : a : this parameter is the bottom b : this parameter is the exponent. Return : This technique returns ab .
Example 1 : To present working of java.lang.Math.pow() technique.
900.0 81.0 64.0
Example 2 : To present working of java.lang.Math.pow() technique when argument is NaN.
NaN 1.0 5.0