python math.log10()方法,求10为底对数

math.log10()方法

math模块的log10()方法,可以求取以10对底数的对数值,相当于math.log()的第二个参数为10。


log10()语法

log10(x)

python源码对log10()方法的介绍:

    Return the base 10 logarithm of x.

参数

参数描述
x必须参数,real number,如int或float等类型

提示:如果不传递参数,或参数的值不是real number,python都将抛出TypeError。


返回值

float类型值。


math.log10()方法实例代码

下方实例对比了math.log10()方法和math.log()的一些用法

>>> import math
>>> math.log(10,10)
1.0
>>> math.log10(10)
1.0

全栈后端 / Python库 :









Copyright © 2022-2024 笨鸟工具 x1y1z1.com All Rights Reserved.