This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

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 <>
I'd like to reopen this. I'm still in favor of something like to this

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.
Date User Action Args
2008-07-03 23:39:34gvanrossumsetspambayes_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:34gvanrossumsetspambayes_score: 0.000303778 -> 0.000303778
messageid: <>
2008-07-03 23:39:33gvanrossumlinkissue1580 messages
2008-07-03 23:39:32gvanrossumcreate