liveBook · Manning

Mantissa

As explained in JavaScript in Depth

The significant portion of a floating-point value that is multiplied by a power of the radix.

Why can 0.1 + 0.2 be awkward in JavaScript? The answer begins with the mantissa, also called the significand: the significant value scaled by a power of the radix. In decimal, 123.45 can be written as 12345 × 10⁻²; 12345 is the significand. Floating-point numbers use radix 2 instead. section 3.1.1

A JavaScript Number uses IEEE-754 Binary64: one sign bit, 11 exponent bits, and 52 stored significand bits. For the binary value shown by the encoding equation, those significand bits follow a leading 1; the exponent supplies the power of 2 that scales it. section 3.1.1

Table 3.3 Representing 0.1 and 0.2 as floating-point numbers
Value
Sign
Exponent
Significand
0.1
0
01111111011
1.1001100110011001100110011001100110011001100110011010
0.2
0
01111111100
1.1001100110011001100110011001100110011001100110011010

The encodings of 0.1 and 0.2 show their significand bit patterns and different exponents, making the binary representation concrete. section 3.1.1

The practical distinction is simple: the mantissa supplies significant bits, while the exponent sets their scale. Reading both is necessary to understand a floating-point value. section 3.1.1

How JavaScript in Depth covers it

How deep it goes
Defines the term and relates stored significand bits to Binary64’s sign, biased exponent, and value equation.
Examples
Uses 12345 × 10⁻² and the binary encodings of 0.1 and 0.2.
What it assumes
Introduces radix, exponent, and significand through a decimal example before applying them to binary encoding.
What you can do after
Evaluate/understand a floating-point encoding by separating its significant bits from its exponent.
How it connects
Connects the mantissa to the significand, radix, exponent, scientific notation, and IEEE-754 Binary64.

Also explained in

Compare how 7 books explain mantissa →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of JavaScript in Depth. The section links point to the parts of the book it draws on.