Metoda Python math.ldexp().
Příklad
Návratová hodnota 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))
Definice a použití
Metoda math.ldexp()
vrací x * (2**i) daných čísel x a i, což je inverzní hodnota k
math.frexp() .
Syntax
math.ldexp(x, i)
Hodnoty parametrů
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 |
Technické údaje
Návratová hodnota: | Hodnota x * (2**i) |
---|---|
Verze Pythonu: | 2.6 |