Author mark
Recipients christian.heimes, gvanrossum, mark
Date 2007-12-16.19:10:57
SpamBayes Score 0.000458989
Marked as misclassified No
Message-id <200712161907.20339.mark@qtrac.eu>
In-reply-to <47645C6D.8090502@cheimes.de>
Content
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 makes cross-platform testing less convenient than it need be.
> >
> > I'll take a look at those functions next week.
>
> It should be fixed in the trunk and merged into py3k. 2.6 suffers from
> the same problem.
>
> By the way I have another pending patch which adds consistent handling
> of "nan" and "inf" on all platforms to float.

Hi Christian,

I've added some code to pystrtod.c's PyOS_ascii_formatd() function that
ensures that the exponent is always at least 3 digits, so long as the
buffer passed in has room.

Although I have svn access, this was granted to me by Georg Brandl only
for doing documentation edits, so I don't feel that I can submit code
patches myself---and in any case my C is rusty, so I would prefer my
code was peer reviewed anyway. Would you be willing to add the patch for
me, assuming you are happy with it?

I've attached my modified pystrtod.c and also pystrtod.diff which shows
the diff against Python 30a2. My code is at the end of the function all
in one lump so it is easy to see what I've done. (I've assumed ANSI C,
so have declared some local variables in my code block rather than at
the top of the function: start, exponent_digit_count, and zeros; they
could all be moved if necessary.)

I hope this helps:-)
Files
File name Uploaded
pystrtod.c mark, 2007-12-16.19:10:57
pystrtod.diff mark, 2007-12-16.19:10:57
History
Date User Action Args
2007-12-16 19:10:59marksetspambayes_score: 0.000458989 -> 0.000458989
recipients: + mark, gvanrossum, christian.heimes
2007-12-16 19:10:58marklinkissue1600 messages
2007-12-16 19:10:57markcreate