CKTIS / Python
math.log10
Calcula el logaritmo decimal para comparar órdenes de magnitud.
Versión: Python 3.14; repository image, production runtime not attested
Sintaxis
math.log10(x, /)Calcula el logaritmo decimal para comparar órdenes de magnitud.
De 10³ = 1000 se obtiene 3,0 y de 10⁰ = 1 se obtiene 0,0. Una fracción positiva menor que uno tiene logaritmo negativo.
Cero y las entradas negativas provocan ValueError.
import math
assert math.log10(1000) == 3.0 and math.log10(1) == 0.0
assert math.log10(0.1) == -1.0
Ejemplos
import math
print(math.log10(1000))
print(math.log10(1))
Resultado
3.0 0.0
Cero y las entradas negativas provocan ValueError.