Re: [Numpy-discussion] Precision in Python
6 Dec
2006
6 Dec
'06
12:52 a.m.
-----Original Message----- From: numpy-discussion-bounces@scipy.org [mailto:numpy-discussion-bounces@scipy.org] On Behalf Of Elton Mendes Sent: Monday, November 27, 2006 13:57 To: numpy-discussion@scipy.org 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.
6511
Age (days ago)
6511
Last active (days ago)
0 comments
1 participants
participants (1)
-
Nadav Horesh