-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Elton Mendes
Sent: Monday, November 27, 2006 13:57
To: [email protected]
Subject: [Numpy-discussion] Precision in Python

 

Hi.
I'm having a precision problem in python

Example:


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

It´s possible to round the number exactly to 5.1
NO. 

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.

 

  Nadav.

_______________________________________________
Numpy-discussion mailing list
[email protected]
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to