Python cmath.isnan() နည်းလမ်း
ဥပမာ
ရှုပ်ထွေးသောတန်ဖိုးသည် NaN ဟုတ်မဟုတ် စစ်ဆေးပါ-
#import cmath for complex number operations
import cmath
#find
whether a complex number is NaN or not
print (cmath.isnan(12 +
float('nan')))
print (cmath.isnan(2 + 3j))
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
နည်းလမ်း သည် cmath.isnan()
တန်ဖိုးသည် nan (နံပါတ်မဟုတ်) ဟုတ်မဟုတ် စစ်ဆေးသည်။ ဤနည်းလမ်းသည် Boolean တန်ဖိုးကို ပြန်ပေးသည်- True
တန်ဖိုးသည် nan ဖြစ်ပါက၊ မဟုတ်လျှင်False
အထားအသို
cmath.isnan(x)
ကန့်သတ်တန်ဖိုးများ
Parameter | Description |
---|---|
x | Required. The value to check for NaN |
နည်းပညာဆိုင်ရာအသေးစိတ်
ပြန်ပို့တန်ဖိုး- | ကိန်းဂဏန်း တစ်ခု၏ အစိတ်အပိုင်းတစ်ခု (အစစ်အမှန် သို့မဟုတ် စိတ်ကူးယဉ်) ဖြစ်ပါက bool တန်ဖိုး သည် NaN ဖြစ်သည်၊ မဟုတ်လျှင်True False |
---|---|
Python ဗားရှင်း- | ၂.၆ |