# StrictMath expm1() Method in Java With Examples

The java.lang.StrictMath.expm1() is an inbuilt method in Java which is used to return the exponential e^num -1 for a given value of num. The method gives rise to four different cases:

• The method returns NaN when the given argument is NaN.
• The result is positive infinity when the argument is positive infinity.
• The result is negative infinity when the argument is negative infinity.
• For 0 the methods return 0 with the same sign as the argument.

Syntax :

`public static double expm1(double num)`

Parameters: This method accepts one parameter num of double type and refers to the value on which the exponential operation is to be performed.

Return Value: The method will return the result of enum – 1 operation.

Examples :

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

Input: 32.2
Output: 9.644557735961714E13
```

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

 `// Java praogram to illustrate the ` `// java.lang.StrictMath.expm1() ` `import` `java.lang.*; ` ` `  `public` `class` `Geeks { ` ` `  `public` `static` `void` `main(String[] args) { ` ` `  `    ``double` `num1 = ``0.0``, num2 = -(``1.0``/``0.0``); ` `        ``double` `num3 = (``1.0``/``0.0``), num4 = ``32.2``; ` `     `  `    ``/*It  returns e^num - 1 */` `    ``double` `eValue = StrictMath.expm1(num1);  ` `    ``System.out.println(``"The expm1 Value of "``+ ` `                              ``num1+``" = "``+eValue); ` `     `  `    ``eValue = StrictMath.expm1(num2);  ` `    ``System.out.println(``"The expm1 Value of "``+ ` `                              ``num2+``" = "``+eValue); ` `     `  `    ``eValue = StrictMath.expm1(num3); ` `    ``System.out.println(``"The expm1 Value of "``+ ` `                              ``num3+``" = "``+eValue); ` `     `  `    ``eValue = StrictMath.expm1(num4); ` `    ``System.out.println(``"The expm1 Value of "``+ ` `                              ``num4+``" = "``+eValue);} ` `} `

Program 2:

 `// Java praogram to illustrate the ` `// java.lang.StrictMath.expm1() ` `import` `java.lang.*; ` ` `  `public` `class` `Geeks { ` ` `  `public` `static` `void` `main(String[] args) { ` ` `  `    ``double` `num1 = ``2.0` `, num2 = -``51.8``; ` `        ``double` `num3 = ``61.0``, num4 = -``32.2``; ` `     `  `    ``/*It  returns e^num - 1 */` `    ``double` `eValue = StrictMath.expm1(num1);  ` `    ``System.out.println(``"The expm1 Value of "``+ ` `                              ``num1+``" = "``+eValue); ` `     `  `    ``eValue = StrictMath.expm1(num2);  ` `    ``System.out.println(``"The expm1 Value of "``+ ` `                              ``num2+``" = "``+eValue); ` `     `  `    ``eValue = StrictMath.expm1(num3); ` `    ``System.out.println(``"The expm1 Value of "``+ ` `                              ``num3+``" = "``+eValue); ` `     `  `    ``eValue = StrictMath.expm1(num4); ` `    ``System.out.println(``"The expm1 Value of "``+ ` `                              ``num4+``" = "``+eValue); ` `} ` `} `

Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.

My Personal Notes arrow_drop_up Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

Article Tags :
Practice Tags :

Be the First to upvote.

Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.