CKTIS / Python
math.log10
Calcula o logaritmo decimal para comparar ordens de grandeza.
Versão: Python 3.14; repository image, production runtime not attested
Sintaxe
math.log10(x, /)Calcula o logaritmo decimal para comparar ordens de grandeza.
De 10³ = 1000 resulta 3,0 e de 10⁰ = 1 resulta 0,0. Uma fração positiva inferior a um tem logaritmo negativo.
Zero e entradas negativas geram ValueError.
import math
assert math.log10(1000) == 3.0 and math.log10(1) == 0.0
assert math.log10(0.1) == -1.0
Exemplos
import math
print(math.log10(1000))
print(math.log10(1))
Resultado
3.0 0.0
Zero e entradas negativas geram ValueError.