This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: printing 1e23 and up is incorrect
Type: behavior Stage: resolved
Components: Versions: Python 3.5
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: eric.smith, jftuga, mark.dickinson
Priority: normal Keywords:

Created on 2016-02-23 21:25 by jftuga, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (2)
msg260745 - (view) Author: John Taylor (jftuga) * Date: 2016-02-23 21:25
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
msg260747 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2016-02-23 22:14
Please see https://docs.python.org/3.5/tutorial/floatingpoint.html for a discussion of why this is not a bug.
History
Date User Action Args
2022-04-11 14:58:27adminsetgithub: 70609
2016-02-24 08:26:09mark.dickinsonsetnosy: + mark.dickinson
2016-02-23 22:14:27eric.smithsetstatus: open -> closed

nosy: + eric.smith
messages: + msg260747

resolution: not a bug
stage: resolved
2016-02-23 21:25:46jftugacreate