Languages
[Edit]
EN

Python - math.log10() method example

0 points
Created by:
MMORex
600

The math.log10() method returns the logarithm with base 10 of a number.

import math

# Logarithm with base 10:
#                 x            y
print(math.log10( 1     ) )  # 0
print(math.log10( 3     ) )  # 0.47712125471966244
print(math.log10( 10    ) )  # 1
print(math.log10( 100   ) )  # 2
print(math.log10( 1000  ) )  # 3

print(math.log10(-1))        # ValueError
print(math.log10(0))         # ValueError
print(math.log10(math.inf))  # inf

The math.log10() method is presented on the following chart:

math.log10(x) function visualization - Python math module.
math.log10(x) function visualization - Python math module.

1. Documentation

Syntax
math.log10(x)
Parametersx - double value in the range 0 to infinity.
Result

number value calculated as log_10(x) mathematical function.

If x is negative it returns ValueError.

If x is equal to 0 it returns ValueError.

If x is equal to infinity it returns infinity.

Description

log10 is a method that takes one parameter and returns an approximation of the log_10(x) mathematical function (logarithm with base 10). log10 is called a common logarithm.

References

  1. Logarithm - Wikipedia

Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

Cross technology - Math.log10()

Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join