December 2018
Beginner to intermediate
796 pages
19h 54m
English
Real numbers, or floating point numbers, are represented in Python according to the IEEE 754 double-precision binary floating-point format, which is stored in 64 bits of information divided into three sections: sign, exponent, and mantissa.
Usually, programming languages give coders two different formats: single and double precision. The former takes up 32 bits of memory, and the latter 64. Python supports only the double format. Let's see a simple example:
>>> pi = 3.1415926536 # how many digits of PI can you remember?>>> radius = 4.5>>> area = pi * (radius ** 2)>>> area63.617251235400005
Read now
Unlock full access