Python3-number-log10

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

Python 3-数値log10()メソッド

説明

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

構文

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

import math

math.log10( x )

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

パラメーター

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

戻り値

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

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

#!/usr/bin/python3
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(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.0755469613925306
math.log10(math.pi) :  0.49714987269413385