Méthode Python math.ldexp()
Exemple
Valeur de retour de 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))
Définition et utilisation
La math.ldexp()
méthode renvoie x * (2**i) des nombres donnés x et i, qui est l'inverse de
math.frexp() .
Syntaxe
math.ldexp(x, i)
Valeurs des paramètres
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 |
Détails techniques
Valeur de retour : | La valeur de x * (2**i) |
---|---|
Version Python : | 2.6 |