[Tutor] the binary math "wall"

Dave Angel davea at ieee.org
Thu Apr 22 03:47:56 CEST 2010

Steven D'Aprano wrote:
> On Thu, 22 Apr 2010 01:37:35 am Lowell Tackett wrote:
> <snip>
>> Were I to accumulate many of these "legs" into perhaps a 15 mile
>> traverse-accumulating little computer errors along the way-the end
>> result could be catastrophically wrong.
> YES!!! 
> And just by being aware of this potential problem, you are better off 
> than 90% of programmers who are blithely unaware that floats are not 
> real numbers.
Absolutely.  But "catastrophically wrong" has to be defined, and 
analyzed.  If each of these measurements is of 100 feet, measured to an 
accuracy of .0001 feet, and you add up the measurements in Python 
floats, you'll be adding 750 measurements, and your human error could 
accumulate to as much as .07 feet.

The same 750 floating point ads, each to 15 digits of quantization 
accuracy (thanks for the correction, it isn't 18) will give a maximum 
"computer error" of  maybe .000000001 feet.  The human error is much 
larger than the computer error.

No results can be counted on without some analysis of both sources of 
error.  Occasionally, the "computer error" will exceed the human, and 
that depends on the calculations you do on your measurements.


More information about the Tutor mailing list