Mike Meyer wrote: > "John Roth" <[EMAIL PROTECTED]> writes: > > > "Mike Meyer" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > >> PEP: XXX > >> Title: A rational number module for Python ... > >> Rationals will mix with all other numeric types. When combined with an > >> integer type, that integer will be converted to a rational before the > >> operation. When combined with a floating type - either complex or > >> float - the rational will be converted to a floating approximation > >> before the operation, and a float or complex will be returned. The > >> reason for this is that floating point numbers - including complex - > >> are already imprecise. To convert them to rational would give an > >> incorrect impression that the results of the operation are > >> precise. Decimals will be converted to rationals before the > >> operation. [Open question: is this the right thing to do?] > > > > I'd prefer to have rationals converted to decimals before > > the operation, for the same reason that they're converted > > to floats. Decimals also have limited precision. > > I'm of two minds about this one. One is that decimals have limited > precision. But they represent their values exactly,
You just contradicted yourself. The decimal class exactly represents numbers that have exact, concise representations in decimal, such as monetary amounts. It doesn't represent arbitary numbers exactly. Otherwise, why bother implememting a rational class? ... > On the other hand, > every decimal has a rational equivalent, but not vice versa. The same statement is true for floats. -- http://mail.python.org/mailman/listinfo/python-list