Java Math.exp() method

The java.lang.Math.exp() is used to return the Euler's number e raised to the power of a double value. Here, e is an Euler's number and it is approximately equal to 2.718281828459045.

Syntax

Parameter

Return

It returns the value ex, where e is the base of the natural logarithms.
  • If the argument is positive or negative double value, this method will return the output.
  • IIf the argument is Zero, this method will return 1.0.
  • IIf the argument is Positive Infinity, this method will return Positive Infinity.
  • IIf the argument is Negative Infinity, this method will return Positive Zero.
  • IIf the argument is NaN, this method will return NaN.

Example 1

Test it Now

Output:

7.38905609893065

Example 2

Test it Now

Output:

9.118819655545162E-4

Example 3

Test it Now

Output:

1.0

Example 4

Test it Now

Output:

Infinity

Example 5

Test it Now

Output:

0.0

Example 6

Test it Now

Output:

NaN

Next TopicJava Math




Latest Courses