√ ~ % python3
Python 3.7.9 (default, Nov 20 2020, 23:58:42) 
[Clang 12.0.0 (clang-1200.0.32.27)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

 

기본자료형(Built-in Types, Primitive Types, Base Types)


숫자형(Numeric Type)

숫자형에는 정수형(Integer type), 부동 소수점형(fixed point, floating point), 복소수형(complex type)이 있다. 수학의 수의 체계에서 실수는 유리수와 무리수로 이루어진다. 유리수는 정수와 정수가 아닌 유리수로 이루어 진다. 수학의 수의 체계를 그대로 옮겨 놓은 것이 파이썬의 숫자형(Numeric Type) 이다.

 

파이썬 정수형의 한계(limitation)는 다음과 같이 알아 볼 수 있다.

√ ~ % python3 -c 'import sys; print(sys.maxsize)'
9223372036854775807

 

파이썬 실수형 정보는 다음과 같이 알 수 있다.

√ ~ % python3
Python 3.7.9 (default, Nov 20 2020, 23:58:42) 
[Clang 12.0.0 (clang-1200.0.32.27)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

>>> import sys
>>> sys.float_info
sys.float_info(max=1.7976931348623157e+308, max_exp=1024, max_10_exp=308, min=2.2250738585072014e-308, min_exp=-1021, min_10_exp=-307, dig=15, mant_dig=53, epsilon=2.220446049250313e-16, radix=2, rounds=1)

 

프로그래머에게는 의미있는 몇 개의 숫자들이 있다.

 



 


 

파이썬의 수 체계는 64비트를 따른다는 것을 알 수 있다.

 

'{BE} Python 3.1x' 카테고리의 다른 글

기본 에러 정리  (0) 2021.05.26
파이썬을 쉘로 써보기  (0) 2021.05.26
python 빌드해서 에러 문구 교체해 봄.  (0) 2021.05.26
how to see the encoding  (0) 2021.05.26
AI 기본은 필수...  (0) 2021.05.20

+ Recent posts