Python math.log10()メソッド
例
異なる数の10を底とする対数を求めます
# Import math Library
import math
# Return the base-10 logarithm
of different numbers
print(math.log10(2.7183))
print(math.log10(2))
print(math.log10(1))
定義と使用法
このmath.log10()
メソッドは、数値の10を底とする対数を返します。
構文
math.log10(x)
パラメータ値
Parameter | Description |
---|---|
x | Required. Specifies the value to calculate the logarithm for. If the value is 0 or a negative number, it returns a ValueError. If the value is not a number, it returns a TypeError |
技術的な詳細
戻り値: | 数値の10を底とする対数を表すfloat 値 |
---|---|
Pythonバージョン: | 2.3 |