0

I tried the below JavaScript in Chrome console:

// Case 1
0.11 * 10000 // 1100
0.14 * 10000 // 1400.000...2
// Both of 0.11 and 0.14 are infinite in binary number



// Case 2
0.14 * 10 // 1.4000...1
0.14 * 100 // 14.000...2
0.14 * 1000 // 140



// Case 3
0.14e4 // 1400

Can anyone explain the behaviour in each case?

HKIT
  • 628
  • 1
  • 8
  • 19
  • This question has already been answered at: https://stackoverflow.com/questions/588004/is-floating-point-math-broken – mihawk26 Dec 14 '19 at 06:58
  • The link does help a lot but it does not explain the behaviour of above cases. – HKIT Dec 14 '19 at 07:49

0 Answers0