Python math.isinf() Yöntem
Örnek
Bir değerin sonsuz olup olmadığını kontrol edin:
# 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))
Tanım ve Kullanım
Yöntem math.isinf()
, bir sayının sonsuz olup olmadığını kontrol eder.
Bu yöntem, belirtilen sayı pozitif veya negatif bir sonsuz ise True döndürür, aksi takdirde False döndürür.
Sözdizimi
math.isinf(x)
Parametre Değerleri
Parameter | Description |
---|---|
x | Required. The number to check |
Teknik detaylar
Geri dönüş değeri: | Bir bool değer, x pozitif veya negatif bir sonsuzluksa True, aksi takdirde False |
---|---|
Python Sürümü: | 2.6 |