Skip to content

Instantly share code, notes, and snippets.

@tennisonchan
Created June 17, 2017 15:03
Show Gist options
  • Save tennisonchan/41b1dec403fbc69ff8c581ddbc6d5518 to your computer and use it in GitHub Desktop.
Save tennisonchan/41b1dec403fbc69ff8c581ddbc6d5518 to your computer and use it in GitHub Desktop.
MAX_SAFE_INTEGER and MIN_SAFE_INTEGER
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER
// Following IEEE754 [Double-precision floating-point format](https://en.wikipedia.org/wiki/Double-precision_floating-point_format)
// Not Support in IE
Number.MAX_SAFE_INTEGER // 9007199254740991
Number.MIN_SAFE_INTEGER // -9007199254740991
// Fun fact
Number.MAX_SAFE_INTEGER + 1 == Number.MAX_SAFE_INTEGER + 2 // => true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment