Karthikeyan Singaravelan <tir.kar...@gmail.com> added the comment:
Thanks for the report but I think is a known limitation with floating points and this page explains it well : https://docs.python.org/3.7/tutorial/floatingpoint.html . Using round will be helpful in your situation to round the output to 2 decimal places. I think the issue is also not predictable and a below example on Python 3 is similar to your case. I think this is not a bug in Python but a known behavior that is also present in a lot of other languages. >>> 0.1+0.2 0.30000000000000004 >>> 0.2+0.2 0.4 >>> 0.2+0.3 0.5 >>> 0.2+0.4 0.6000000000000001 >>> ---------- nosy: +xtreak _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue34907> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com