Message85733
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.) |
|
Date |
User |
Action |
Args |
2009-04-07 18:32:28 | jaredgrubb | set | recipients:
+ jaredgrubb, gvanrossum, tim.peters, nascheme, rhettinger, amaury.forgeotdarc, mark.dickinson, eric.smith, christian.heimes, alexandre.vassalotti, noam, preston |
2009-04-07 18:32:27 | jaredgrubb | set | messageid: <1239129147.7.0.799924294482.issue1580@psf.upfronthosting.co.za> |
2009-04-07 18:32:26 | jaredgrubb | link | issue1580 messages |
2009-04-07 18:32:26 | jaredgrubb | create | |
|