Home >Backend Development >Python Tutorial >How many bytes does Python's floating point number occupy?

How many bytes does Python's floating point number occupy?

anonymity
anonymityOriginal
2019-06-11 09:14:1916010browse

Floating point numbers are represented by the native double precision (64 bit) of the floating point number on the machine. Provides approximately 17 digits of precision and an exponent ranging from -308 to 308. It is the same as the double type in C language. Python does not support 32-bit single-precision floating point numbers. If your program requires precise control over intervals and numerical precision, consider using the numpy extension library.

How many bytes does Python's floating point number occupy?

Python 3.X provides a precision of 17 digits by default for floating point numbers.

Popular explanation about single precision and double precision:

Single precision type and double precision type, their type specifier is float single precision specifier, double double precision specifier. In Turbo C, the single precision type occupies 4 bytes (32 bits) of memory space, its value range is 3.4E-38 ~ 3.4E 38, and can only provide seven significant digits. The double precision type occupies 8 bytes (64 bits) of memory space, its value range is 1.7E-308 ~ 1.7E 308, and can provide 16 significant digits.

The above is the detailed content of How many bytes does Python's floating point number occupy?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:Scope of python variablesNext article:Scope of python variables