On Sat, 15 Dec 2007 22:20:22 -0800, Dennis Lee Bieber wrote: > On Sun, 16 Dec 2007 06:09:06 -0000, Steven D'Aprano > <[EMAIL PROTECTED]> declaimed the following in > comp.lang.python: > >> Yes, but my point (badly put, I admit) was that people find fractions >> far easier to work with than they find floating point numbers. And with >> any rational data type worth the name, you simply should never get >> anything as unintuitive as this: >> >> >>> from __future__ import division >> >>> 4/10 + 2/10 == 6/10 >> False > > Which only seems to me to prove that having integer division return > a floating value is a mistake <G>
What integer division? It's floating point division. The / operator creates floats. If I wanted integer division, I would have used //. > My background with mostly ancient > languages (FORTRAN) reads that and sees "0 + 0 == 0", With some floating point implementations, one can find values such that x == 0.0 and y == 0.0 but x + y != 0.0. > and "4.0/10.0 + 2.0/10.0 == 6.0/10.0" automatically makes me leery... *shrug* That's the whole point. Floating point math is weird. Rationals are not. Using floats when you actually need rationals is dangerous. -- Steven -- http://mail.python.org/mailman/listinfo/python-list