目录

log10(x)

描述 (Description)

方法log10()返回x的基数-10对数,表示x“0。

语法 (Syntax)

以下是log10()方法的语法 -

import math
math.log10( x )

Note - 此函数不能直接访问,因此我们需要导入数学模块,然后我们需要使用数学静态对象调用此函数。

参数 (Parameters)

  • x - 这是一个数字表达式。

返回值 (Return Value)

对于x> 0,此方法返回x的基数-10对数。

例子 (Example)

以下示例显示了log10()方法的用法。

#!/usr/bin/python
import math   # This will import <b class="notranslate">math</b> module
print "math.log10(100.12) : ", math.log10(100.12)
print "math.log10(100.72) : ", math.log10(100.72)
print "math.log10(119L) : ", math.log10(119L)
print "math.log10(math.pi) : ", math.log10(math.pi)

当我们运行上面的程序时,它产生以下结果 -

math.log10(100.12) :  2.00052084094
math.log10(100.72) :  2.0031157171
math.log10(119L) :  2.07554696139
math.log10(math.pi) :  0.497149872694
↑回到顶部↑
WIKI教程 @2018