as shown below for some reason 15.06 + 5 results in an addition of 0.0000002 and i want to know why its an bug or something im doing wrong but below it i tried it with 15.07 it works
because you have the round with the float type. you could use the decimal module with Decimal In [1]: import decimal In [2]: decimal.Decimal('15.06') + 5 Out[2]: Decimal('20.06')
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 >>>
For future reference, please don't post unnecessary screen shots and images. Code is text, please copy and paste it as text, not as pixels. Images make it difficult or impossible for the blind and visually impaired to contribute.