Java Math expm1() Method

Facebooktwitterredditpinterestlinkedinmailby feather

The expm1() method of Math class returns ex-1 where e represents Euler’s number.

Syntax:

public static double expm1(double x)

Parameters:

The parameter ‘x’ represents the exponent to raise e in the calculation of ex-1.

Return Value:

The expm1 () method returns the value of ex – 1.

Special cases of the expm1() method are as follows:

  • It returns NaN, is the argument passed is NaN.
  • It returns positive infinity, if the argument passed is positive infinity.
  • It returns -1.0, if the argument passed is negative infinity.
  • It returns zero with the same sign as the argument, if the argument passed is zero.

Example 1:

 Output:

Example 2:

 Output:

Example 3:

 Output:

Example 4:

 Output:

Example 5:

 Output:

Facebooktwitterredditpinterestlinkedinmailby feather