andresj <[EMAIL PROTECTED]> writes:

> The problem arises when you try to represent some number, like 0.4 in
> a float.

Which is really a specific case of the general problem that, for any
given number base, some non-integer numbers cannot be exactly
represented as fractions.

> Secondly, what happens if I need to sum 1/3 and 0.4? I could use
> Decimal to represent 0.4 precisely, but what about 1/3?

What about the sum of π (pi) and √2 (sqrt(2))?

> So the solution I think is using a fraction type/class

As explained above, a fractional-number class only shifts the "exact
representation" problem, it doesn't solve it.

-- 
 \         "Facts do not cease to exist because they are ignored."  -- |
  `\                                                     Aldous Huxley |
_o__)                                                                  |
Ben Finney
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to