[Tutor] puzzled by Python 3's print()

शंतनू (Shantanoo) shantanoo at gmail.com
Thu Jul 1 10:41:40 CEST 2010


without using decimal module:

>>> x = 2000000000000034
>>> print('%d'%(x/2))
1000000000000017


On Thu, Jul 1, 2010 at 13:56, Richard D. Moores <rdmoores at gmail.com> wrote:
>>>> x = 2000000000000034
>>>> x/2
> 1000000000000017.0
>>>> print(x/2)
> 1e+15
>
> I was expecting, in fact needing, 1000000000000000017 or 1000000000000000017.0
>
> 1e+15 is unsatisfactory. Am I forced to use the decimal module?
>
> Dick Moores
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>


More information about the Tutor mailing list