Bigint

Proposals to the ECMAScript standard have recently included support for handling really large numbers. Most programming languages already natively support 64 bit numbers, but JavaScript has lagged behind in this respect, and currently only supports numbers that are at 53 bit precision. The reasons for this particular constraint are quite detailed, and boil down to the internal representation that JavaScript uses to store numbers in memory. Any number representation in memory needs to take into account both the sign, either positive or negative, and the precision of a number, or in other words the number of decimal places. In JavaScript, the largest number that can be used when using 53 bit precision is 9,007,199,254,740,991, which, ...

Get Mastering TypeScript 3 - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.