파이썬 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 , x 가 양수 또는 음의 무한대이면 True, 그렇지 않으면 False |
---|---|
파이썬 버전: | 2.6 |