Number

The number primitive type is used to express numerical data. It stores this data in the double-precision 64-bit floating-point format (IEEE 754). 64 bits here refers to there being 64 binary digits available to store information. The entire 64-bit format that's used in the IEEE 754 standards can be broken down into three chunks:

  • 1 bit for the sign of the number being represented: Whether the number is positive or negative
  • 11 bits for the exponent of the number: This tells us where the radix or decimal dot resides
  • 52 bits for what's termed the fraction or significand: This tells us the integer value
A side effect of this floating-point formation means that there are technically two zeros: positive zero (+0) and negative zero (-0

Get Clean Code in JavaScript 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.