[triangle-zpug] rounding errors with floating point operations

Philip Semanchuk philip at semanchuk.com
Sat Jul 19 21:36:36 UTC 2008


On Jul 19, 2008, at 5:28 PM, Joseph Mack NA3T wrote:

> On Sat, 19 Jul 2008, Philip Semanchuk wrote:
>
>> If I'm not mistaken, Python is limited to the accuracy of the  
>> underlying C library for floating point ops. Here's a page that can  
>> probably answer your question:
>> http://docs.python.org/tut/node16.html
>
> Thanks, this confirms what I know so far, which is comforting. I  
> went to the Lahey compiler link where the author gives examples like  
> I was trying, which in his hands fail but in my hands don't fail.  
> One of the caveates is that in some implemenations, multiplication  
> and division use double wide registers, in which the bits are all  
> retained till the end, so none are lost in the middle.
>
> This is a possible explanation for what I have, but I don't know  
> enough about the linux/pentium/python/C math library to know if this  
> is what I have.

Glad that helped.

Note that Python has a Decimal type to help deal with some of these  
quirks.






More information about the triangle-zpug mailing list