I try to compute x = (2**83 + 1)/3 which is mathematically an integer and a float in python-x. In python 2, I get :
x = 2**83 + 1
x = 9671406556917033397649409L
then
y = x/3 = 3223802185639011132549803L
In python 3, I get :
x = 2**83 + 1
x = 9671406556917033397649409 --> OK
then
y = x/3 = 3.223802185639011e+24
To compare the 2 results, I use a format string instruction in python 3:
z = '%25d' % y
and I get z = '3223802185639010953592832'
and z = '3223802185639011132549803'
in python 2.
(%i gives the same results, quite normal).
The strange thing is that when I compute 3*Z, I get the good result in python2 and a wrong one in python3.
I can't see where the problem is with my test (computing, formatting, ...).
I'd like to use python 3 and to display x = (2**83 + 1)/3
with no 'e+24'
but with all numbers.
Does anybody have an idea?
I have to add thet the problem remains the same when using / or // in python2. We get the same result sinc it is mathematically an integer. I should say that the problem is rather with python 3. How can i get the good result (the whole dispaly of (2**83 + 1)/3 in python 3) ?