Skip to main content

[JS] Number

Encoding

The JavaScript Number type is a double-precision 64-bit binary format IEEE 754 value, like double in Java or C#.

This means it can represent fractional values, but there are some limits to the stored number's magnitude and precision.

Very briefly, an IEEE 754 double-precision number uses 64 bits to represent 3 parts:

  • 1 bit for the sign (positive or negative)
  • 11 bits for the exponent (-1022 to 1023)
  • 52 bits for the mantissa (representing a number between 0 and 1)
Number(89.123123366666667777) // will be 89.12312336666666
  • StackOverflow - When JavaScript maximum number length more than 16,what happen ?

Reference