java.lang.Math log10(double a)

Description :

This java tutorial shows how to use the log10(double a) method of Math class under java.lang package. This method returns the base 10 logarithm of a value specified as method argument.

Method Syntax :

public static double log10(double a)

Parameter Input :

DataType Parameter Description
double a the value which we want to determine the base 10 logarithm

Method Returns :

The log10(double a) method simply returns the base 10 logarithm of a in consideration of the following special cases:

  • If the argument is NaN or less than zero, then the result is NaN.
  • If the argument is positive infinity, then the result is positive infinity.
  • If the argument is positive zero or negative zero, then the result is negative infinity.
  • If the argument is equal to 10n for integer n, then the result is n.

Compatibility Version :

Requires Java 1.5 and up

Exception :

N/A

Java Code Example :

This java example source code demonstrates the use of log10(double a) method of Math class. Basically we just ask for user input and then we will get the logarithm base 10.

Sample Output :

Running the log10(double a) method example source code of Math class will give you the following output

Exception Scenario :

N/A

Similar Method :

  • N/A

Suggested Reading List :

References :