When adding 0.2 to 0.1 in python why is the sum 0.30000000000000004? | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
+ 1

When adding 0.2 to 0.1 in python why is the sum 0.30000000000000004?

16th Jan 2022, 2:56 AM
Pawan
2 ответов
+ 3
Computers use binary numbers so do python. Some decimal numbers cannot be expressed exact in binary (infinite binary number) so computer do an aproximation.
16th Jan 2022, 3:16 AM
Christina Ricci
Christina Ricci - avatar