Steven D'Aprano <>:

>>    >>> Rational(2).sqrt() * Rational(2).sqrt() == Rational(2)
>>    False
> Square root of 2 is not a rational number.

Nobody said it was. It's just that even "arbitrary-precision" rational
numbers wouldn't free you from the issues of floating-point numbers. The
Decimal number class won't do it, either, of course.

On the other hand, floating-point numbers are perfect whenever you deal
with science and measurement. And when you deal with business (= money),
integers are the obvious choice.

I would venture to say that the real applications for Decimal are very
rare. In practice, I'm afraid, people with rather a weak understanding
of numbers and computation might gravitate toward Decimal unnecessarily.


Reply via email to