Floating Point Real Numbers

Floats in Python are implemented as C doubles, double precision floating point real numbers, values which can be represented in straightfoward decimal or scientific notations. These 8-byte (64-bit) values conform to the IEEE 754 definition (52M/11E/1S) where 52 bits are allocated to the mantissa, 11 bits to the exponent (this gives you about ± 10308.25 in range), and the final bit to the sign. That all sounds fine and dandy; however, the actual amount of precision you will receive (along with the range and overflow handling) depends completely on the architecture of the machine as well as the implementation of the compiler which built your Python interpreter.
Floating point values are denoted by a decimal point ( . ) in the appropriate place and an optional “e” suffix representing scientific notation. We can use either lowercase ( e ) or uppercase ( E ). Positive (+) or negative ( – ) signs between the “e” and the exponent indicate the sign of the exponent. Absence of such a sign indicates a positive exponent. Here are some floating point values:

0.0 -777. 1.6 -5.555567119 96e3 * 1.0
4.3e25 9.384e-23 -2.172818 float(12) 1.000000001
3.1416 4.2E-10 -90 . 6.022e23 -1.609E-19


You may also like...

No © Loop and Break