Guido van Rossum <gu...@python.org> added the comment: On Tue, Apr 7, 2009 at 3:10 AM, Mark Dickinson <rep...@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. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue1580> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com