Python Math.log1p() Metoda
Przykład
Znajdź dziennik (1+numer) dla różnych numerów
# 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))
Definicja i użycie
Metoda math.log1p()
zwraca log(1+number), obliczony w sposób dokładny nawet wtedy, gdy wartość liczby jest bliska zeru.
Składnia
math.log1p(x)
Wartości parametrów
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 |
Szczegóły techniczne
Wartość zwrotu: | Wartość float reprezentująca wartość logarytmiczną 1+ liczby |
---|---|
Wersja Pythona: | 2,6 |