Home >>Java Math Methods >Java Math.expm1() method

Java Math.expm1() method

Java Math.expm1() method

The Math.expm1() Method in Java Math is used to return the number e generated by the Euler to the power of a double value, and to subtract it from one form. Here, e is the number of an Euler and is roughly equal to 2.718281828459045.

Syntax

public static double expm1(double x)

Parameters

x = This parameter is used to the exponent to raise e to in the computation of ex -1.

Returns

It is used to returns the value of ex - 1

  1. This method returns the output if the statement is positive or negative double value.
  2. If Positive Infinity is the argument, then this method returns Positive Infinity.
  3. If Negative Infinity is the statement this method will return -1.0.
  4. If Zero is the argument, the method returns Zero with the same sign as the argument.
  5. This method returns -1 if the statement is -1.

Java Math.expm1() Method Example 1


public class MyClass  
{  
    public static void main(String[] args)   
    {  
        double x = 3.0;  
        System.out.println(Math.expm1(x));  
  }  
}  

Output:
19.085536923187668

Java Math.expm1() Method Example 2


public class Main  
{  
    public static void main(String[] args)   
    {  
        double a = -4.0;  
        System.out.println(Math.expm1(a));  
    }  
}  

Output:
-0.9816843611112658

No Sidebar ads