Syntax - Python's integers and floating point numbers have no size limit?
某草草
某草草 2017-05-18 10:57:58
0
2
1568

I have learned C before, now I am learning Python 3.5, the picture below is from Liao Xuefeng’s website

Why do Python integers and floating point numbers have no size limit? ? How are integers and floating point numbers stored in Python?

Does it mean that all declared integers and floating-point numbers in Python are directly equivalent to long long and long double in C, and are directly allocated to the maximum memory?

某草草
某草草

reply all(2)
phpcn_u1582

Python's integers can theoretically be of any length (far beyond long long) as long as the memory can fit.
If C’s long can fit, use long. If it cannot fit, it will automatically convert to a large integer. This process is basically transparent to programmers.
Floating point numbers should be the double type of C.

Floating point numbers are usually implemented using double in C. ——Python official documentation

PHPzhong

In Python, the length of an integer is unlimited as long as there is enough memory. It should be much larger than long long in C.

Floating point numbers use double precision (64 bit) on the machine, providing about 17 significant digits, which should be similar to the double type in C.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!