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








Syntax

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

public static double log10(double a)

Example

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

//from   ww w.  java  2  s.  co  m
public class Main {

  public static void main(String[] args) {
  
    double d1 = 0.0 , d2 = 1234.5, d3 = (1.0/0.0), d4 = 1;

    System.out.println("Log " + d1 + " with base 10 = " + StrictMath.log10(d1));
     
    System.out.println("Log " + d2 + " with base 10 = " + StrictMath.log10(d2));
     
    System.out.println("Log " + d3 + " with base 10 = " + StrictMath.log10(d3));
     
    System.out.println("Log " + d4 + " with base 10 = " + StrictMath.log10(d4));
  }
}

The code above generates the following result.