Java Data Type Tutorial - Java StrictMath.log(double a)








Syntax

StrictMath.log(double a) has the following syntax.

public static double log(double a)

Example

In the following code shows how to use StrictMath.log(double a) method.

/*from  w  ww  . j a  v a2  s .c o  m*/
public class Main {

  public static void main(String[] args) {
  
    double d1 = 10 , d2 = 0.0 , d3 = (1.0/0.0), d4 = 1.0;
     
    System.out.println("Log value of " + d1 + " = " + StrictMath.log(d1));
     
    System.out.println("Log value of " + d2 + " = " + StrictMath.log(d2));
     
    System.out.println("Log value of " + d3 + " = " + StrictMath.log(d3));
     
    System.out.println("Log value of " + d4 + " = " + StrictMath.log(d4));
  }
}

The code above generates the following result.