martin.spic...@gmail.com writes: > print int(float(2.8/0.1)) > > yields > > 27 > > instead of 28!!
That's how floating-point arithmetic works: look at the result of 2.8/0.1 to see why int() is correct. > Is that known? Yes, it is known, and correct since you use "float". See http://floating-point-gui.de/ for a nice explanation. Use decimal (https://docs.python.org/2/library/decimal.html) if you need exact representations. -- Alain. -- https://mail.python.org/mailman/listinfo/python-list