Author gvanrossum
Recipients alexandre.vassalotti, amaury.forgeotdarc, christian.heimes, eric.smith, gvanrossum, mark.dickinson, nascheme, noam, preston, rhettinger, tim.peters
Date 2009-04-07.14:54:01
SpamBayes Score 1.0494e-09
Marked as misclassified No
Message-id <ca471dc20904070753k7cea9437mfc1081169c6ce36a@mail.gmail.com>
In-reply-to <1239099032.49.0.0300384762178.issue1580@psf.upfronthosting.co.za>
Content
On Tue, Apr 7, 2009 at 3:10 AM, Mark Dickinson <report@bugs.python.org> wrote:
> A proposal: I propose that the short float representation should be
> considered an implementation detail for CPython, not a requirement for
> Python the language.  This leaves Jython and IronPython and friends free
> to do as they wish.

In principle that's fine with me.

> All that should be required for Python itself is
> that float(repr(x)) == x for (non-nan, non-infinite) floats x.  Does
> this seem reasonable to people following this issue?  If it's
> controversial I'll take it to python-dev.

Historically, we've had a stronger requirement: if you print repr(x)
and ship that string to a different machine, float() of that string
returns the same value, assuming both systems use the same internal FP
representation (e.g. IEEE). Earlier in this bug (or elsewhere) Tim
Peters has pointed out that on some platforms, in particular Windows,
input conversion doesn't always round correctly and only works
correctly when the input has at least 17 digits (in which case you
apparently don't need to round, and truncation works just as well --
that's all the C standard requires, I believe).

Now that pickle and marshal no longer use repr() for floats I think
this is less important, but still at least worth considering. I think
by having our own input function we solve this if both hosts run
CPython, but it might break for other implementations.

In order to make progress I recommend that we just not this and don't
use it to hold up the implementation, but I think it's worth noticing
in docs somewhere.
History
Date User Action Args
2009-04-07 14:54:04gvanrossumsetrecipients: + gvanrossum, tim.peters, nascheme, rhettinger, amaury.forgeotdarc, mark.dickinson, eric.smith, christian.heimes, alexandre.vassalotti, noam, preston
2009-04-07 14:54:02gvanrossumlinkissue1580 messages
2009-04-07 14:54:01gvanrossumcreate