Strange behaviour with numbers in exponential notation
Christian Gollwitzer
auriocus at gmx.de
Fri Sep 2 12:18:08 EDT 2016
Am 02.09.16 um 17:51 schrieb Marco Sulla:
>>>> 10**26 - 1
> 99999999999999999999999999
>>>> 1e26 - 1
> 1e+26
>
10**26 is computed with integer arithmetics. Python has bigints (i.e. as
big as the memory allows)
1e26 denotes a *floating point number* Floating point has finite
precision, in CPython it is a 64bit IEEE number. The largest exact
integer there is 2**53 (~10^16), everything beyond cannot be accurately
represented.
Christian
More information about the Python-list
mailing list