New submission from steve21 <steve872929...@yahoo.com.au>:

I wish to round the float 697.04157958254996 to 10 decimal digits after
the decimal point.

$ python3.0
Python 3.0.1 (r301:69556, Jun  7 2009, 14:51:41)
[GCC 4.3.2 20081105 (Red Hat 4.3.2-7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

>>> 697.04157958254996
697.04157958254996      # python float can represent this number exactly

>>> 697.04157958250000  # this is the expected result
697.04157958250005      # this is the closest python float representation

>>> round(697.04157958254996, 10)
697.04157958259998      # error

round() gives a result that is closer to
697.0415795826
than the expected result of
697.0415795825
- it has not rounded to the closest 10th decimal digit after the decimal
point.

(python 2.6.2 has the same problem)

----------
messages: 89029
nosy: steve21
severity: normal
status: open
title: round() error
type: behavior
versions: Python 2.6, Python 3.0

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue6228>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to