Message89029
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) |
|
Date |
User |
Action |
Args |
2009-06-07 07:44:04 | steve21 | set | recipients:
+ steve21 |
2009-06-07 07:44:04 | steve21 | set | messageid: <1244360644.6.0.321389592966.issue6228@psf.upfronthosting.co.za> |
2009-06-07 07:44:03 | steve21 | link | issue6228 messages |
2009-06-07 07:44:02 | steve21 | create | |
|