Java Data Type Tutorial - Java Math.log1p(double x)








Syntax

Math.log1p(double x) has the following syntax.

public static double log1p(double x)

Example

In the following code shows how to use Math.log1p(double x) method.

/*from  ww w. j a  v  a2s . c  o m*/

public class Main {

   public static void main(String[] args) {
      double x = 123456.7;
      double y = -123.45;


      // call log1p and print the result
      System.out.println("Math.log1p(" + x + ")=" + Math.log1p(x));

      // call log1p and print the result
      System.out.println("Math.log1p(" + y + ")=" + Math.log1p(y));


   }
}

The code above generates the following result.