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 jaredgrubb
Recipients alexandre.vassalotti, amaury.forgeotdarc, christian.heimes, eric.smith, gvanrossum, jaredgrubb, mark.dickinson, nascheme, noam, preston, rhettinger, tim.peters
Date 2009-04-07.18:32:25
SpamBayes Score 5.857549e-06
Marked as misclassified No
Message-id <1239129147.7.0.799924294482.issue1580@psf.upfronthosting.co.za>
In-reply-to
Content
I think ANY attempt to rely on eval(repr(x))==x is asking for trouble,
and it should probably be removed from the docs.

Example: The following C code can vary *even* on a IEEE 754 platform,
even in two places in the same source file (so same compile options),
even in the same 5 lines of code recompiled after changing code that
does even not touch/read 'x' or 'y':

double x, y;
x = 3.0/7.0;
y = x;
/* ... code that doesnt touch/read x or y ... */
printf(" x==y: %s", (x==y) ? "true" : "false");

So, how can we hope that eval(repr(x))==x is EVER stable? Equality and
floating point should raise the hairs on the back of everyone's neck...

(Code above based on
http://docs.sun.com/source/806-3568/ncg_goldberg.html in section
"Current IEEE 754 Implementations", along with a great explanation on
why this is true. The code example is a little different, but the same
concept applies.)
History
Date User Action Args
2009-04-07 18:32:28jaredgrubbsetrecipients: + jaredgrubb, gvanrossum, tim.peters, nascheme, rhettinger, amaury.forgeotdarc, mark.dickinson, eric.smith, christian.heimes, alexandre.vassalotti, noam, preston
2009-04-07 18:32:27jaredgrubbsetmessageid: <1239129147.7.0.799924294482.issue1580@psf.upfronthosting.co.za>
2009-04-07 18:32:26jaredgrubblinkissue1580 messages
2009-04-07 18:32:26jaredgrubbcreate