[issue1600] str.format() produces different output on different platforms (Py30a2)

2008-03-09 Thread Eric Smith
Eric Smith <[EMAIL PROTECTED]> added the comment: Issue closed with commit r60909. Fixed as suggested by Mark Dickinson: "The exponent always contains at least two digits, and only as many more digits as necessary to represent the exponent." -- resolution: -> fixed status: open -> clos

[issue1600] str.format() produces different output on different platforms (Py30a2)

2008-02-20 Thread Eric Smith
Eric Smith added the comment: Checked in as r60909. I started with Mark's patch, but added code to both increase or decrease the number of zeros, as needed. __ Tracker <[EMAIL PROTECTED]> __ _

[issue1600] str.format() produces different output on different platforms (Py30a2)

2008-02-19 Thread Guido van Rossum
Guido van Rossum added the comment: I would like Python to follow the C99 rule here. It is practical and Python has a long tradition of following C where it makes sense. __ Tracker <[EMAIL PROTECTED]>

[issue1600] str.format() produces different output on different platforms (Py30a2)

2008-02-18 Thread Mark Summerfield
Mark Summerfield added the comment: On 2008-02-18, Mark Dickinson wrote: > Mark Dickinson added the comment: > > I know I'm coming a bit late to this discussion, but I wanted to point > out that the C99 standard does actually specify how many digits should > be in the exponent of a "%e"-formatted

[issue1600] str.format() produces different output on different platforms (Py30a2)

2008-02-18 Thread Eric Smith
Eric Smith added the comment: Given Mark Dickinson's input, I think we should follow it. That effectively means leaving the Linux/MacOS input as is, and modifying the Windows output. I'll work up a patch, but I'd still like to get some input on changing the output of existing, working code. __

[issue1600] str.format() produces different output on different platforms (Py30a2)

2008-02-18 Thread Mark Dickinson
Mark Dickinson added the comment: I know I'm coming a bit late to this discussion, but I wanted to point out that the C99 standard does actually specify how many digits should be in the exponent of a "%e"-formatted number: In section 7.19.6, in the documentation for fprintf, it says: "The expon

[issue1600] str.format() produces different output on different platforms (Py30a2)

2008-02-17 Thread Eric V. Smith
Eric V. Smith added the comment: The PEP 3101 float formatting code (in Objects/stringlib/formatter.h) uses PyOS_ascii_formatd for all specifier codes except 'n'. So applying the patch would fix the issue that was originally brought up in msg58485. I think the approach of the patch (if not its

[issue1600] str.format() produces different output on different platforms (Py30a2)

2008-02-17 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc added the comment: Eric, because of this issue the windows buildbots turned to red. Does the proposed patch still apply? of should be make the tests more tolerant? -- nosy: +amaury.forgeotdarc, eric.smith __ Tracker <[EMAIL PROTECTED]

[issue1600] str.format() produces different output on different platforms (Py30a2)

2007-12-18 Thread Mark Summerfield
Mark Summerfield added the comment: On 2007-12-17, Christian Heimes wrote: > Christian Heimes added the comment: > > Hi Mark! > > In general the patch is fine but it has some small issues. > > * Your patches are all reversed. They remove (-) the new lines instead > of adding (+) them. Why aren't

[issue1600] str.format() produces different output on different platforms (Py30a2)

2007-12-17 Thread Christian Heimes
Christian Heimes added the comment: Hi Mark! In general the patch is fine but it has some small issues. * Your patches are all reversed. They remove (-) the new lines instead of adding (+) them. Why aren't you using svn diff > file.patch? * You are mixing tabs with spaces. All 2.6 C files and m

[issue1600] str.format() produces different output on different platforms (Py30a2)

2007-12-17 Thread Mark Summerfield
Mark Summerfield added the comment: My C is rusty! Attached is new pystrtod.c & diff, this time using memset() instead of looping to padd with zeros. Added file: http://bugs.python.org/file8971/pystrtod.c Added file: http://bugs.python.org/file8972/pystrtod.diff

[issue1600] str.format() produces different output on different platforms (Py30a2)

2007-12-17 Thread Mark Summerfield
Mark Summerfield added the comment: Attached is new version of test_float.py with a few tests to check str.format() with exponents formats, plus a diff. They test that the exponent is always 3 digits and that the case of the e in the format is respected. Added file: http://bugs.python.org/file89

[issue1600] str.format() produces different output on different platforms (Py30a2)

2007-12-16 Thread Mark Summerfield
Mark Summerfield added the comment: On 2007-12-15, Christian Heimes wrote: > Christian Heimes added the comment: > > Mark Summerfield wrote: > > It seems to me that Python should provide consistent results across > > platforms wherever possible and that this is a gratuitous inconsistency > > that

[issue1600] str.format() produces different output on different platforms (Py30a2)

2007-12-16 Thread Mark Summerfield
Mark Summerfield added the comment: On 2007-12-15, Christian Heimes wrote: > Christian Heimes added the comment: > > Mark Summerfield wrote: > > It seems to me that Python should provide consistent results across > > platforms wherever possible and that this is a gratuitous inconsistency > > that

[issue1600] str.format() produces different output on different platforms (Py30a2)

2007-12-15 Thread Christian Heimes
Christian Heimes added the comment: Mark Summerfield wrote: > It seems to me that Python should provide consistent results across > platforms wherever possible and that this is a gratuitous inconsistency > that makes cross-platform testing less convenient than it need be. > > I'll take a look at

[issue1600] str.format() produces different output on different platforms (Py30a2)

2007-12-15 Thread Mark Summerfield
Mark Summerfield added the comment: On 2007-12-15, Christian Heimes wrote: > Christian Heimes added the comment: > > Guido is right. On Linux the system's sprintf() family prints %e, %g and > %f with two or three digits while Windows always uses three digits: > > Linux > >>> "%e" % 1e1 > '1.0

[issue1600] str.format() produces different output on different platforms (Py30a2)

2007-12-15 Thread Christian Heimes
Christian Heimes added the comment: Guido is right. On Linux the system's sprintf() family prints %e, %g and %f with two or three digits while Windows always uses three digits: Linux >>> "%e" % 1e1 '1.00e+01' >>> "%e" % 1e10 '1.00e+10' >>> "%e" % 1e100 '1.00e+100' Windows >>> "%e" %

[issue1600] str.format() produces different output on different platforms (Py30a2)

2007-12-12 Thread Mark Summerfield
Mark Summerfield added the comment: On 2007-12-12, Guido van Rossum wrote: > Guido van Rossum added the comment: > > Again, a (not unreasonable) feature request. AFAIK %e behaves the same > way. I'm sure if you submitted a patch it would be accepted happily. Unfortunately, I can't---I haven't

[issue1600] str.format() produces different output on different platforms (Py30a2)

2007-12-12 Thread Guido van Rossum
Guido van Rossum added the comment: Again, a (not unreasonable) feature request. AFAIK %e behaves the same way. I'm sure if you submitted a patch it would be accepted happily. -- nosy: +gvanrossum priority: -> normal __ Tracker <[EMAIL PROTECTED]>

[issue1600] str.format() produces different output on different platforms (Py30a2)

2007-12-12 Thread Mark Summerfield
New submission from Mark Summerfield: I don't know if this is a bug, but it is certainly a difference in behavior between platforms: Python 3.0a2 on linux2: >>> "{0:.3e}".format(123.45678901) '1.235e+02' Python 3.0a2 on win32: >>> "{0:.3e}".format(123.45678901) '1.235e+002' It seems to me that