Math.pow()

Math.pow() returns the value of second input raised to the power of first input.
Syntax
Math.pow(input_number1,input_number2)
Here are some examples with different type of numbers.
System.out.println(Math.pow(2,2));   //4.0
System.out.println(Math.pow(2,4));   //16.0
System.out.println(Math.pow(-2,-5)); //-0.03125
System.out.println(Math.pow(-2,3));  //-8.0
Using double
System.out.println(Math.pow(2.12,2));     //4.494400000000001
System.out.println(Math.pow(2.12,4.34));  //26.079402457445806
System.out.println(Math.pow(-2.12,-5.67));//NaN
System.out.println(Math.pow(-2.12,3));    //-9.528128


All Math functions

Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com



    Post your comments , suggestion , error , requirements etc here




    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2024 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer