• 회원가입
  • 로그인
  • 구글아이디로 로그인

[module] Python - math.isfinite() 메서드 - 숫자 유한 여부 체크 (= math.isfinite메서드 = 매스이즈인피니트메서드)

1811  
목차
  1. math.isfinite() 예제 - 숫자의 유한 여부 체크
  2. math.isfinite() 정의
  3. math.isfinite() 구문

 

math.isfinite() 예제 - 숫자의 유한 여부 체크

 

import math


print(math.isfinite(2000)) # True

print(math.isfinite(-45.34)) # True

print(math.isfinite(+45.34)) # True

print(math.isfinite(math.inf)) # False

print(math.isfinite(float("nan"))) # False

print(math.isfinite(float("inf"))) # False

print(math.isfinite(float("-inf"))) # False

print(math.isfinite(-math.inf)) # False

print(math.isfinite(0.0)) # True


 

math.isfinite() 정의

 

숫자가 유한한지 여부 체크.

 


 

Python 3.2 +

 

 

math.isfinite() 구문

 

math.isfinite(num)

 


[매개변수]

 

num

필수. 체크할 숫자.
※ 반드시 자료형이 숫자여야 함. (예: float/integer/infinite/NaN/finite)

 


[반환값]

 

숫자가 finite (유한)인 경우, True 반환.
숫자가 infinite (무한) 또는 NaN (숫자아님) 경우, False 반환.

 



분류 제목
basic Python - Home (입문) - 이념 / 추천 링크
basic Python - Intro (소개) - 용도・특징
basic Python - Start (시작) - 파이썬 설치/실행/버전확인
basic Python - Syntax (구문) - 들여쓰기・변수・주석
basic Python - Comment (주석)
basic Python - Variable (변수)
basic Python - DataType (데이터타입) - 자료형
basic Python - Number (숫자)
basic Python - Casting (데이터 타입 변경) - 자료형 변환
basic Python - String (문자열) ★ ※ 색인번호 (= 인덱스) 개념.
basic Python - Boolean (참거짓)
basic Python - Operator (연산자)
basic Python - List (리스트) ★ - 변경 가능한 모음
basic Python - Tuple (투플/튜플) - 변경 불가 모음
basic Python - Set (셋/세트) - '순서(=색인)' 없고, 중복 허용 않는 데이터 모음.
basic Python - Dictionary (딕셔너리) - Key:value 쌍으로 구성된 모음
basic Python - if...elif...else - (이프조건문) ※ 3항연산자 = 삼항연산자
basic Python - While (와일반복문) - 와일문
basic Python - For (포반복문) ★★★★★
basic Python - Function (함수)
1/24
목록
찾아주셔서 감사합니다. Since 2012