+ 1

Is this a Python bug?

When I try to multiply 60 by 0.06 I get 3.599999999... Same goes for 120 * 0.06, 180 * 0.06 and so on.

14th Sep 2020, 4:02 PM
Manushev 🇧🇬❤️🇺🇦
Manushev 🇧🇬❤️🇺🇦 - avatar
5 Antworten
+ 6
Tihomir Manushev , if the floating point data format does not fit to your precission requirements, you can use the decimal data format. Find more information in the python docs: https://docs.python.org/3.7/library/decimal.html
14th Sep 2020, 6:03 PM
Lothar
Lothar - avatar
+ 3
Thank you for your answer. So this means that all programming languages have this issue and I need to format my output by rounding it up
14th Sep 2020, 4:22 PM
Manushev 🇧🇬❤️🇺🇦
Manushev 🇧🇬❤️🇺🇦 - avatar
+ 1
Lothar thank you
14th Sep 2020, 6:31 PM
Manushev 🇧🇬❤️🇺🇦
Manushev 🇧🇬❤️🇺🇦 - avatar