[Python-Dev] Re: PEP239 (Rational Numbers) Reference Implementation and new issues

Oren Tirosh oren-py-d@hishome.net
Thu, 3 Oct 2002 19:10:55 +0300


On Thu, Oct 03, 2002 at 09:05:03AM -0400, Andrew Koenig wrote:
> Oren> Any calculation involving a floating point number should taint
> Oren> the result with inexactitude and yield a floating point result.
> 
> Even comparisons?

Comparisons could produce a third boolean value called 'Undetermined':

result = A>B
if result is Undetermined:
   print "Sorry, difference between A and B is below the error margin"
   print "I cannot determine which one is greater."
else:
   print "%s is greater than %s" % tuple(('BA','AB')[result])





[Taking off absurdly-purist-hat :-]

This actually gives me a serious idea: a floating-point type that helps
keep track of error magnitude. It's a pair of floats (like a complex
number) where the second number is an estimate or limit on the absolute 
value of errors in the first and is updated by all operators. An error
tracking replacement for the math module would also be required.

	Oren