Python can't divide??!?!
Gerrit
gerrit at nl.linux.org
Thu Feb 5 13:34:18 EST 2004
Tim Peters wrote:
> [Dan Williams, surprised by float division]
>
> It's what your hardware does; Python doesn't try to hide it from you; more
> here (this is Appendix B in the Python Tutorial that came with Python):
>
> http://www.python.org/doc/current/tut/node15.html
I think what confuses people is that the simple reprentation in the
interactive shell calls repr(), not str(). If it would, like Ruby, it
would be even more confusing:
19:22:38:0:gerrit at optiplex:~$ irb
irb(main):003:0> v=0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1
=> 1
irb(main):004:0> v
=> 1
irb(main):005:0> v==1
=> false
Gerrit (not a Rubyist, so I don't know if it's possible to get the 'true' internal value).
--
PrePEP: Builtin path type
http://people.nl.linux.org/~gerrit/creaties/path/pep-xxxx.html
Asperger's Syndrome - a personal approach:
http://people.nl.linux.org/~gerrit/english/
More information about the Python-list
mailing list