[Python-Dev] Mixing float and Decimal -- thread reboot

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Mar 23 00:26:14 CET 2010


Nick Coghlan wrote:

> http://docs.python.org/library/decimal.html#decimal.Inexact
> 
> (Part of the thread context rather than the individual decimal values,
> but if you use it properly it tells you whenever an inexact operation
> has occurred in the current thread)

My problem was that the statement "All numbers are exact;
inexactness is a taint" appears to be self-contradictory.
Numbers *can* become tainted with inexactness whether you
explicitly keep track of that or not.

However, the excerpt by Cowlishaw posted earlier reveals
where the confusion is coming from, I think. What Cowlishaw
appears to mean by "numbers are exact" is that Decimals
represent particular values, not *intervals*.

This is not really the same thing as the notion of inexact
numbers in the numeric tower. There, it means more like
"this number may not quite represent the value the programmer
had in mind".

-- 
Greg


More information about the Python-Dev mailing list