Python-number-log10

提供:Dev Guides
移動先:案内検索

Python Number log10()メソッド

説明

Python数値メソッド* log10()*は、x> 0に対してxの10を底とする対数を返します。

構文

以下は* log10()*メソッドの構文です-

import math

math.log10( x )

-この関数は直接アクセスできないため、数学モジュールをインポートしてから、数学静的オブジェクトを使用してこの関数を呼び出す必要があります。

パラメーター

  • x -これは数値式です。

戻り値

このメソッドは、x> 0の場合、xの10を底とする対数を返します。

次の例は、log10()メソッドの使用法を示しています。

#!/usr/bin/python
import math   # This will import math 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