Skip to content

Instantly share code, notes, and snippets.

@siburu
Created September 5, 2015 05:10
Show Gist options
  • Save siburu/4bd60a9fb563f2be7d7d to your computer and use it in GitHub Desktop.
Save siburu/4bd60a9fb563f2be7d7d to your computer and use it in GitHub Desktop.
What if you go beyond Number.MAX_SAFE_INTEGER?
console.log('MAX_SAFE_INTEGER is ' + Number.MAX_SAFE_INTEGER);
let i = Number.MAX_SAFE_INTEGER - 100;
while (i + 1 > i) { i = i + 1; }
console.log('True max integer is ' + i);
console.log('Overflowed integer is ' + (i + 1));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment