laziness, impatience, and hubris | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
The notion that one grain of sand on a beach is not important, but one hundred are, is dubious to say the least. perl -le '$x += 0.1 for 1..100; print $x;' There are couple of points to make. First: it's not about print really. It's about stringification. Perl scalars can get pPOK from "action at a distance"; and stringification is currently lossy. Someone scientifically minded will of course understand the caveats of floating point, but at the same time expect roundtrip accuracy. The numbers must convert back and forth from text to internal representation. This caters to human audiences; to suggest hexdumps or similar would fly in the face of your own argument. Why would you insist people need to go out of their way to have their numbers stringify correctly? Frankly, this sounds like you are discouraging perl use for scientific work ("the wrong tool"). Also reminds me of the definition π = 22/7 ("correct for all practical purposes"). Update. Uh, and a link to one of the curiosities: shortest round-tripping. Update2. Here's a better demonstration of the WTF equality problem.
And yes, this also affects Memoize, FWIW. In reply to Re^5: Variables are automatically rounded off in perl (audiences)
by oiskuu
|
|