-3

Can someone ELI5 why is this the case?

console.log(12313123213456789 === 12313123213456788);
=> true
thefourtheye
  • 233,700
  • 52
  • 457
  • 497
Zen
  • 3
  • 1
    Check `console.log( Number.MAX_SAFE_INTEGER )` – hjpotter92 Aug 09 '14 at 04:34
  • Only integers up to 2^53 can be *distinctly* represented - a double is used for all numeric values. This is a duplicate, I am sure. – user2864740 Aug 09 '14 at 04:36
  • http://stackoverflow.com/questions/307179/what-is-javascripts-max-int-whats-the-highest-integer-value-a-number-can-go-t , http://stackoverflow.com/questions/21350175/max-integer-value-in-javascript – user2864740 Aug 09 '14 at 04:37
  • 1
    I just answered a question like this yesterday. http://stackoverflow.com/questions/25190594/why-are-2-different-numbers-equal-in-javascript/25190668#25190668 – p.s.w.g Aug 09 '14 at 04:38

1 Answers1

0

numbers

All numbers in JS are 64 bit floating point numbers. the largest integral value is 2 pow 53, or 9007199254740992.

Praveen
  • 206
  • 2
  • 11