Python math.log1p()メソッド
例
さまざまな数値のログ(1 +数値)を見つける
# Import math Library
import math
# Return the log(1+number) for different numbers
print(math.log1p(2.7183))
print(math.log1p(2))
print(math.log1p(1))
定義と使用法
このmath.log1p()
メソッドは、numberの値がゼロに近い場合でも正確な方法で計算されたlog(1 + number)を返します。
構文
math.log1p(x)
パラメータ値
Parameter | Description |
---|---|
x | Required. Specifies the number to process. If the value is a negative number, it returns a ValueError. If the value is not a number, it returns a TypeError |
技術的な詳細
戻り値: | 1以上の数値のfloat 対数値を表す値 |
---|---|
Pythonバージョン: | 2.62.6 |