Python math.log2() နည်းလမ်း
ဥပမာ
မတူညီသောဂဏန်းများ၏ အခြေခံ-2 လော့ဂရစ်သမ်ကို ရှာပါ။
# 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))
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
math.log2()
နည်းလမ်းသည် ဂဏန်းတစ်ခု၏ အခြေခံ-2 လော့ဂရစ်သမ်ကို ပြန်ပေးသည် ။
အထားအသို
math.log2(x)
ကန့်သတ်တန်ဖိုးများ
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 |
နည်းပညာဆိုင်ရာအသေးစိတ်
ပြန်ပို့တန်ဖိုး- | ဂဏန်း float တစ်ခု၏ အခြေခံ-2 လော့ဂရစ်သမ်ကို ကိုယ်စားပြုသော တန်ဖိုး |
---|---|
Python ဗားရှင်း- | ၃.၃ |