Python - Methode math.log1p()
Beispiel
Finden Sie das Protokoll (1+Nummer) für verschiedene Nummern
# 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))
Definition und Verwendung
Die math.log1p()
Methode gibt log(1+number) zurück, berechnet auf eine Weise, die auch dann genau ist, wenn der Wert von number nahe Null ist.
Syntax
math.log1p(x)
Parameterwerte
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 |
Technische Details
Rückgabewert: | Ein float Wert, der den Protokollwert von 1+ darstellt |
---|---|
Python-Version: | 2.6 |