Home » Java Math.log10() method with Examples

Java Math.log10() method with Examples

by Online Tutorials Library

Java Math.log10() method

The java.lang.Math.log10() is used to find out the Logarithmic of a number when the base is 10. This method returns the base 10 logarithm of a double value.

Syntax

Parameter

Return

  • If the argument is Positive value, this method will return the logarithm of a given value.
  • If the argument is equal to 10n for integer n, this method will return n.
  • If the argument is Negative value, this method will return NaN.
  • If the argument is NaN, this method will return NaN.
  • If the argument is Positive Infinity, this method will return Positive Infinity.
  • If the argument is positive or negative Zero, this method will return Negative Infinity.

Example 1

Test it Now

Output:

1.5899496013257077  

Example 2

Test it Now

Output:

5.0  

Example 3

Test it Now

Output:

Infinity  

Example 4

Test it Now

Output:

NaN  

Example 5

Test it Now

Output:

-Infinity  

Next TopicJava Math

You may also like