Message69232
| Author | gvanrossum |
|---|---|
| Recipients | alexandre.vassalotti, amaury.forgeotdarc, christian.heimes, gvanrossum, mark.dickinson, nascheme, noam, rhettinger, skip.montanaro, tim.peters |
| Date | 2008-07-03.23:39:31 |
| SpamBayes Score | 0.00030377827 |
| Marked as misclassified | No |
| Message-id | <1215128374.38.0.701347056925.issue1580@psf.upfronthosting.co.za> |
| In-reply-to |
| Content | |
|---|---|
I'd like to reopen this. I'm still in favor of something like to this
algorithm:
def float_repr(x):
s = "%.16g" % x
if float(s) != x:
s = "%.17g" % x
s1 = s
if s1.startswith('-'):
s1 = s[1:]
if s1.isdigit():
s += '.0' # Flag it as a float
# XXX special case inf and nan, see floatobject.c::format_double
return s
combined with explicitly using %.17g or the new hex notation (see issue
3008) in places where cross-platform correctness matters, like pickle
and marshal.
This will ensure float(repr(x)) == x on all platforms, but not cross
platforms -- and I don't care.
I'm fine with only doing this in 3.0. |
|
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2008-07-03 23:39:34 | gvanrossum | set | spambayes_score: 0.000303778 -> 0.00030377827 recipients: + gvanrossum, tim.peters, skip.montanaro, nascheme, rhettinger, amaury.forgeotdarc, mark.dickinson, christian.heimes, alexandre.vassalotti, noam |
| 2008-07-03 23:39:34 | gvanrossum | set | spambayes_score: 0.000303778 -> 0.000303778 messageid: <1215128374.38.0.701347056925.issue1580@psf.upfronthosting.co.za> |
| 2008-07-03 23:39:33 | gvanrossum | link | issue1580 messages |
| 2008-07-03 23:39:32 | gvanrossum | create | |