Java Math log10()

The syntax of the log10() method is:

Math.log10(double x)

Here, log10() is a static method. Hence, we are calling the method directly using the class name Math.


log10() Parameters

  • x - the value whose logarithm is to be computed

log10() Return Values

  • returns the base 10 logarithm of x
  • returns NaN if x is NaN or less than zero
  • returns positive infinity if x is positive infinity
  • returns negative infinity if x is zero

Note: The value of log10(10n) = n, where n is an integer.


Example: Java Math.log10()

In the above example, notice the expression,

Math.log10(Math.pow(10, 3))

Here, Math.pow(10, 3) returns 103. To learn more, visit Java Math.pow().


Recommended Tutorial