[Numpy-discussion] Precision in Python

Nadav Horesh nadavh at visionsense.com
Wed Dec 6 00:52:35 CST 2006



-----Original Message-----
From: numpy-discussion-bounces at scipy.org [mailto:numpy-discussion-bounces at scipy.org] On Behalf Of Elton Mendes
Sent: Monday, November 27, 2006 13:57
To: numpy-discussion at scipy.org
Subject: [Numpy-discussion] Precision in Python


I'm having a precision problem in python


>>> a = 5.14343434
>>> b = round(a,1)
>>> b

It´s possible to round the number exactly to 5.1

5.1 can not be represented exactly as a machine native float. The only way I know to represent this value exactly is to use the decimal module. Usually you do not want to do this.



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20061206/aa803ebb/attachment.html 

More information about the Numpy-discussion mailing list