+ 2

Why is the output false?

Here is the screen shot : https://www.dropbox.com/s/an11p5rd9boqys3/Screenshot_2018-07-19-11-28-39-165.jpeg?raw=1 This is where Javascript goes kidding :¬)

19th Jul 2018, 6:04 AM
777
777 - avatar
8 Antworten
19th Jul 2018, 6:35 AM
Kirk Schafer
Kirk Schafer - avatar
+ 3
Also in C++ and Java. While I was googling about this, I saw this site : http://0.30000000000000004.com xD
19th Jul 2018, 6:26 AM
777
777 - avatar
+ 2
Everyone should read this!
19th Jul 2018, 6:31 AM
Satyam
+ 1
Not only in JavaScript!
19th Jul 2018, 6:23 AM
Satyam
+ 1
That is AMAZING!
19th Jul 2018, 6:30 AM
Satyam
+ 1
Kirk Schafer Thanks for the post!
19th Jul 2018, 6:52 AM
777
777 - avatar
+ 1
It actually make sense. In many languages, the digital number is stored as floating points, and floating points cannot store the exact value of 10^-n such as 0.1, 0.01, 0.001, etc. and will store them as the closest number that floating point can store. Then the strange thing happens. Hope you guys know what i am saying.
19th Jul 2018, 7:51 AM
LAWArthur