# StrictMath exp() Method in Java

• Last Updated : 13 Dec, 2021

All methods of java.lang.StrictMath class : Set 1, Set 2
The java.lang.StrictMath.exp() is an inbuilt method in Java is used to return a Euler number raised to the power of the specified double value. It gives rise to three special results:

• The result is positive infinity when the given argument is positive infinity.
• The result is positive zero when the argument is negative infinity.
• The result is NaN when the given argument is NaN.

Syntax :

`public static double exp(double num)`

Parameters: This method accepts one parameter num which is of double type which is the exponent to raise e to.
Return Value: The method returns the value e^num, where e is the base of the natural logarithms.
Examples:

```Input: num = 7
Output: 1096.6331584284585

Input: num = (1.0 / 0.0)
Output: Infinity```

Below programs illustrate the java.lang.StrictMath.exp() method:
Program 1:

## java

 `// Java program to illustrate the``// java.lang.StrictMath.exp()``import` `java.lang.*;` `public` `class` `Geeks {` `    ``public` `static` `void` `main(String[] args)``    ``{` `        ``double` `num1 = ``0.0``, num2 = (``1.0` `/ ``0.0``);``        ``double` `num3 = ``4``;` `        ``// Returns Euler's number e raised to the given power``        ``double` `expValue = StrictMath.exp(num1);``        ``System.out.println("The exp value of "+``                         ``num1+" = " + expValue);` `        ``expValue = StrictMath.exp(num2);``        ``System.out.println("The exp value of "+``                         ``num2+" = " + expValue);` `        ``expValue = StrictMath.exp(num3);``        ``System.out.println("The exp value of "+``                         ``num3+" = " + expValue);    }``}`

Output:

```The exp value of 0.0 = 1.0
The exp value of Infinity = Infinity
The exp value of 4.0 = 54.598150033144236```

Program 2:

## java

 `// Java program to illustrate the``// java.lang.StrictMath.exp()``import` `java.lang.*;` `public` `class` `Geeks {` `    ``public` `static` `void` `main(String[] args)``    ``{` `        ``double` `num1 = -``0.0``, num2 = (``1.0` `/ ``0.0``);``        ``double` `num3 = ``14``;` `        ``// Returns Euler's number e raised to the given power``        ``double` `expValue = StrictMath.exp(num1);``        ``System.out.println("The exp value of "+``                         ``num1+" = " + expValue);` `        ``expValue = StrictMath.exp(num2);``        ``System.out.println("The exp value of "+``                         ``num2+" = " + expValue);` `        ``expValue = StrictMath.exp(num3);``        ``System.out.println("The exp value of "+``                         ``num3+" = " + expValue);``    ``}``}`

Output:

```The exp value of -0.0 = 1.0
The exp value of Infinity = Infinity
The exp value of 14.0 = 1202604.2841647768```

My Personal Notes arrow_drop_up