Python math.log2() Yöntemi
Örnek
Farklı sayıların 2 tabanlı logaritmasını bulun
# Import math Library
import math
# Return the base-2 logarithm
of different numbers
print(math.log2(2.7183))
print(math.log2(2))
print(math.log2(1))
Tanım ve Kullanım
Yöntem math.log2()
, bir sayının 2 tabanlı logaritmasını döndürür.
Sözdizimi
math.log2(x)
Parametre Değerleri
Parameter | Description |
---|---|
x | Required. Specifies the value to calculate the logarithm for. If the value is 0, or a negative number, it returns a ValueError. If the value is not a number, it returns a TypeError |
Teknik detaylar
Geri dönüş değeri: | Bir float sayının taban-2 logaritmasını temsil eden bir değer |
---|---|
Python Sürümü: | 3.3 |