[issue16609] random.random() / float() loses precision when passed to str()

R. David Murray added the comment: In fact it has been changed. In Python3 you get:
Even in 2.7 you would get the above repr, not the one you showed. This is because 2.7 and 3.3 use the "shortest repr" described in the floating point document, but 2.7 still uses the old rounding as the default str representation (for backward compatibility reasons). While you could still make an argument for updating the 2.7 docs, I'm not sure it is worth it. If you (or anyone) want to propose a patch, I would suggest that instead of adding a note to the random docs, that a glossary entry be added for 'floating point' which mentions it as a 2.7 limitation, and a link to that glossary entry from the random docs. ---------- assignee: -> docs@python components: +Documentation -Interpreter Core nosy: +docs@python, r.david.murray priority: normal -> low type: -> behavior _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue16609> _______________________________________
participants (1)
-
R. David Murray