Ka-Ping Yee wrote:
On Sun, 9 Apr 2000, Christian Tismer wrote:
Here is the problem, as I see it: You say if you type 3.1416, you want to get exactly this back. But how should Python know that you typed it in? Same in my case: I just rounded to 3 digits, but how should Python know about this?
And what do you expect when you type in 3.14160, do you want the trailing zero preserved or not?
It's okay for the zero to go away, because it doesn't affect the value of the number. (Carrying around a significant-digit count or error range with numbers is another issue entirely, and a very thorny one at that.)
I think "fewest digits needed to distinguish the correct value" will give good and least-surprising results here. This method guarantees:
Hmm, I hope I understood. Oh, wait a minute! What is the method? What is the correct value? If I type
0.1 0.10000000000000001 0.10000000000000001 0.10000000000000001
There is only one value: The one which is in the machine. Would you think it is ok to get 0.1 back, when you actually *typed* 0.10000000000000001 ? -- Christian Tismer :^) <mailto:tismer@appliedbiometrics.com> Applied Biometrics GmbH : Have a break! Take a ride on Python's Kaunstr. 26 : *Starship* http://starship.python.net 14163 Berlin : PGP key -> http://wwwkeys.pgp.net PGP Fingerprint E182 71C7 1A9D 66E9 9D15 D3CC D4D7 93E2 1FAE F6DF where do you want to jump today? http://www.stackless.com