Java Basic Examples

Find exponential using pow method of Math class in Java

This example shows how to find exponential number using pow() method of Java Math class.

How to find exponential value in Java?

Use pow() static method of Java Math class to find exponential number in Java.

Where x is the base value and y is the exponent.

This method returns the value of base raised to the power of exponent.

Output

Below given table shows some of the special case base and exponent values and their respective results.

BaseExponentResult
Any0 or -01.0
Any1.0Same as base value
AnyNaNNaN
NaNNon ZeroNaN
abs(base) > 1Double.POSITIVE_INFINITYDouble.POSITIVE_INFINITY
abs(base) < 1Double.NEGATIVE_INFINITYDouble.POSITIVE_INFINITY
abs(base) > 1Double.NEGATIVE_INFINITY0
abs(base) < 1Double.POSITIVE_INFINITY0
1Double.POSITIVE_INFINITY or

Double.NEGATIVE_INFINITY

NaN
0>00
Double.POSITIVE_INFINITY< 00
0< 0Double.POSITIVE_INFINITY
Double.POSITIVE_INFINITY> 0Double.POSITIVE_INFINITY
0> 0 and != finite odd integer0
Double.NEGATIVE_INFINITY< 0 and != finite odd integer0
-0positive finite odd integer-0
Double.NEGATIVE_INFINITYnegative finite odd integer-0
-0< 0 and != finite odd integerDouble.POSITIVE_INFINITY
Double.NEGATIVE_INFINITY> 0 and != finite odd integerDouble.POSITIVE_INFINITY
-0negative finite odd integerDouble.NEGATIVE_INFINITY
Double.NEGATIVE_INFINITYpositive finite odd integerDouble.NEGATIVE_INFINITY

Please let us know your views in the comments section below.

Want to learn quickly?
Try one of the many quizzes. I promise you will not be disappointed.

Tags

About the author

rahimv

rahimv

rahimv has over 15 years of experience in designing and developing Java applications. His areas of expertise are J2EE and eCommerce. If you like the website, follow him on Facebook, Twitter or Google Plus.

Add Comment

Your email address will not be published. Required fields are marked *