+ 2

Why this happens to floats?

Hey guys, can anyone figure out why the result of this simple operation comes out wrong ? (this a part of a bigger program) btc = 0.00325911 doge = 0.431001 total = btc + doge print(total) #output : 0.43426011000000003 Normally if we add those two numbers, the result is definitely different (0.43426011); but why in here it’s miscalculated ? Thanks in advance for the answers🙏🏻

21st Sep 2021, 2:29 PM
Ali Hosseinzadeh
Ali Hosseinzadeh - avatar
1 Odpowiedź