Python math.ldexp()- Methode
Beispiel
Rückgabewert von x * (2**i):
#Import math Library
import math
#Return value of x * (2**i)
print(math.ldexp(9, 3))
print(math.ldexp(-5, 2))
print(math.ldexp(15,
2))
Definition und Verwendung
Die math.ldexp()
Methode gibt x * (2**i) der angegebenen Zahlen x und i zurück, was die Umkehrung von
math.frexp() ist .
Syntax
math.ldexp(x, i)
Parameterwerte
Parameter | Description |
---|---|
x | Required. A positive or negative number. If the value is not a number, it returns TypeError |
i | Required. A positive or negative number. If the value is not a number, it returns TypeError |
Technische Details
Rückgabewert: | Der Wert von x * (2**i) |
---|---|
Python-Version: | 2.6 |