Latest web development tutorials

python3 LOG10()関数

python3デジタル python3デジタル


説明

LOG10()メソッドは、x> 0、xの10を底とする対数を返します。


文法

次の構文LOG10()メソッドです。

import math

math.log10( x )

注:LOG10()直接アクセスすることはできません、我々は静的オブジェクトを介してメソッドを呼び出し、数学のモジュールをインポートする必要があります。


パラメータ

  • X - 数値式。

戻り値

戻り値は、x> 0、xの10対数をベースにします。

以下は、LOG10()メソッドの使用例を示します。

#!/usr/bin/python3
import math   # 导入 math 模块

print ("math.log10(100.12) : ", math.log10(100.12))
print ("math.log10(100.72) : ", math.log10(100.72))
print ("math.log10(119) : ", math.log10(119))
print ("math.log10(math.pi) : ", math.log10(math.pi))

上の例の出力を実行した後です。

math.log10(100.12) :  2.0005208409361854
math.log10(100.72) :  2.003115717099806
math.log10(119) :  2.075546961392531
math.log10(math.pi) :  0.4971498726941338

python3デジタル python3デジタル