Posted over 5 years ago. Visible to the public. Repeats.

Heads up: JavaScript does not like big numbers

In a JavaScript console, type this:

Copy
> 9112347935156469760 9112347935156470000

Ooops.

This occurs because JavaScript uses double precision floats to store numbers.

So according to IEEE floating point definition only numbers between -(2^53 - 1) (-9007199254740991) and 2^53 - 1 (9007199254740991) can safely be represented in JavaScript.

Note that ECMAScript 6 will probably also offer Number.MAX_SAFE_INTEGER (and Number.MAX_SAFE_INTEGER) that point to those numbers, but browser support for that is still scarce.

For arbitrary large numbers (even >= 2^53), BigInt objects can be used starting with ECMAScript 2020. Recent versions of Chrome/FF/Opera already support the new class, but it won't work on other Browsers like IE11/Edge/Safari. (Last checked on January 2020)

Does your version of Ruby on Rails still receive security updates?
Rails LTS provides security patches for old versions of Ruby on Rails (3.2 and 2.3).

Owner of this card:

Avatar
Tobias Kraze
Last edit:
3 months ago
by Michael Leimstädtner
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Tobias Kraze to makandra dev
This website uses cookies to improve usability and analyze traffic.
Accept or learn more