[New-bugs-announce] [issue26422] printing 1e23 and up is incorrect

John Taylor report at bugs.python.org
Tue Feb 23 16:25:46 EST 2016


New submission from John Taylor:

The print statement does not display accurate results.

code:
    print("%35d" % (1e21))
    print("%35d" % (1e22))
    print("%35d" % (1e23))
    print("%35d" % (1e24))
    print("%35d" % (1e25))
    print("%35d" % (1e26))
    print("%35d" % (1e27))
    print("%35d" % (1e28))
    print("%35d" % (1e29))
    print("%35d" % (1e30))
    print("%35d" % (1e31))

result:
             1000000000000000000000
            10000000000000000000000
            99999999999999991611392
           999999999999999983222784
         10000000000000000905969664
        100000000000000004764729344
       1000000000000000013287555072
       9999999999999999583119736832
      99999999999999991433150857216
    1000000000000000019884624838656
    9999999999999999635896294965248

Platforms:
Windows 10 x64, Python 3.5.1
Debian 8 (jessie), Python 3.5.1

----------
messages: 260745
nosy: jftuga
priority: normal
severity: normal
status: open
title: printing 1e23 and up is incorrect
type: behavior
versions: Python 3.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue26422>
_______________________________________


More information about the New-bugs-announce mailing list