+ 6

Why is this sum incorrect?

I'm trying to count numbers with 2 or more digit behind the comma. Problem I'm getting is that the count is not valid and all of the sudden it counts with 16 digits behind the comma?! JS counts not 0.001 every interval, but 0.0010000000000001 every interval... Therefore counting it 100x by incrementing it with 0.001 the output should be 0.1 but it is 0.10100000000000008 Acts like that even with 1 digits behind the comma. How to prevent, fix this & Why this behavior happens? https://code.sololearn.com/WSoEVpTwM5cv/?ref=app

12th Oct 2018, 9:38 AM
🌴Vincent Berger🌴
🌴Vincent Berger🌴 - avatar
1 Respuesta
+ 2
ODLNT, Thank you, appericiate it👍
12th Oct 2018, 6:58 PM
🌴Vincent Berger🌴
🌴Vincent Berger🌴 - avatar