ringgono / python-for-android

Automatically exported from code.google.com/p/python-for-android
Apache License 2.0
0 stars 0 forks source link

Round function not working properly #48

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

 size = 8.74 * 1024 * 1024
r = round(size / 1024 / 1024, 2)
print(round(size / 1024 / 1024, 2), 

r = round(size / 1024 / 1024, 3)
print(round(size / 1024 / 1024, 3), r)

r = round(size / 1024 / 1024, 4)
print(round(size / 1024 / 1024, 4), r)

r = round(size / 1024 / 1024, 1)
print(round(size / 1024 / 1024, 1), r) 

What is the expected output? What do you see instead?
 8.74 8.74

8.74 8.74

8.74 8.74

8.7 8.7 

8.7400000000000002 8.7400000000000002 

8.7400000000000002 8.7400000000000002 

8.6999999999999993 8.6999999999999993 

What version of the product are you using? On what operating system?

Py3k4a r6, sl4a r5, android 2.3.6

Please provide any additional information below.

Using a Samsung Galaxy Note.

This is really weird, and I can live with it for now but it really messes 
things up.

Original issue reported on code.google.com by thabub...@gmail.com on 8 May 2012 at 8:36