طريقة Python math.isinf ()
مثال
تحقق مما إذا كانت القيمة لا نهائية أم لا:
# Import math Library
import math
# Check whether the values are
infinite or not
print(math.isinf(56))
print(math.isinf(-45.34))
print(math.isinf(+45.34))
print(math.isinf(math.inf))
print(math.isinf(float("nan")))
print(math.isinf(float("inf")))
print(math.isinf(float("-inf")))
print(math.isinf(-math.inf))
التعريف والاستخدام
تتحقق الطريقة math.isinf()
مما إذا كان الرقم لا نهائيًا أم لا.
ترجع هذه الطريقة True إذا كان الرقم المحدد لانهاية موجبة أو سالبة ، وإلا فإنها ترجع False.
بناء الجملة
math.isinf(x)
قيمه المعامل
Parameter | Description |
---|---|
x | Required. The number to check |
تفاصيل تقنية
قيمة الإرجاع: | قيمة bool ، صواب إذا كانت س لانهاية موجبة أو سالبة ، خطأ في الحالات الأخرى |
---|---|
نسخة بايثون: | 2.6 |