Bugs item #1534769, was opened at 2006-08-04 20:07 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1534769&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Submitted By: Marc W. Abel (gihon) Assigned to: Nobody/Anonymous (nobody) Summary: Identical floats print inconsistently Initial Comment: Hi, and thank you. Many bugs relating to this have been submitted by others over a period of years, and these have generally been closed with "not a bug" responses. I'll do my best to explain the problem clearly enough. The following session prints a single variable three ways, with two different results: ----------- [EMAIL PROTECTED] current]$ python Python 2.4.1 (#1, May 16 2005, 15:19:29) [GCC 4.0.0 20050512 (Red Hat 4.0.0-5)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> a = round(1./7, 3) >>> print a 0.143 >>> print (a,) (0.14299999999999999,) >>> print (a,)[0] 0.143 >>> ----------- I'm fully informed about IEEE floating point representations in binary, but the limitations of data type are not causing the difference in output. The interpreter is using different rules to print this float, depending on whether it's a straight float or part of some other structure (in this example, a tuple). Once the interpreter recurses to a depth where it's clearly going to print a float, whatever rule is selected needs to be consistently applied. This means calling the same string formatting code with the same inputs. Marc ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1534769&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com