4
$\begingroup$

I'm trying to understand IEEE 754 floating point. when I try convert 0.3 from decimal to binary with online calculator, it said the significand value was 1.2

Where 1.2 come from?

I did understand another bits like exponent and sign bit.

.3 if converted to binary it will be

.3 * 2 = .6 + 0
.6 * 2 = .2 + 1
.2 * 2 = .4 + 0
.4 * 2 = .8 + 0
.8 * 2 = .6 + 1
...

So 0.3 = 0.010011001... in binary

Apply the scientific notation in binary:

0.010011001 = 1.0011001 * 2 ^ (-2)

So the exponent is -2. And the normalized mantissa is 0011001...

I will not talk about exponent bit and sign bit. Back to the my question, what is the difference of significand and mantissa?

$\endgroup$
1
  • $\begingroup$ 1.2 is right there in your question. You just wrote it as .2 + 1. $\endgroup$ Commented Jun 12, 2022 at 15:05

3 Answers 3

8
$\begingroup$

In base 2, the significand is a number of the form $1.b_1b_2\ldots$ where the $b_i$'s are base 2 digits. The mantissa is the digits $b_1b_2\ldots$.

More generally, in base $n$, the normalized significand $s$ and exponent $e$ of a positive number $x$ are the numbers such that $x = s \cdot n^{e}$, $1 \le s < n$ and $e$ is an integer (negative if $x < 1$). In the case of base 2, the integer part of $s$ is always $1$ (since the definition yields $1 \le s < 2$). So instead it's usual to write the number as $x = (1 + m) \cdot n^{e}$ with $0 \le m < 1$. The digits of $m$ in base 2 (or the fractional part of $s$, depending on who you ask) are called the (normalized) mantissa.

For $x = 0.3$, we have $x = 1.2 \cdot 2^{-2}$ so for its representation in base 2, the exponent is $-2$, the significand is $1.2_{10} = 1.001\overline{1001}_2$ (where $x_n$ means the digits are written in base $n$ and $\overline{1001}$ means the digits are repeated infinitely many times). The mantissa is the digits after the point: $001\overline{1001}$.

$\endgroup$
4
  • $\begingroup$ How about the difference about normalized mantissa and unnormalized mantissa? $\endgroup$ Commented Jun 11, 2022 at 15:37
  • 2
    $\begingroup$ @MuhammadIkhwanPerwira My answer is about the normalized mantissa. A non-normalized significand/exponent/mantissa would be numbers satisfying the equation $x = s \cdot n^e$ but where $e$ is not in the range $[1,n)$, so the integer part of $s$ is either 0 or a multiple-digit integer. $\endgroup$ Commented Jun 11, 2022 at 15:49
  • $\begingroup$ Your answer seems to be making a distinction between significand and mantissa, with the former being the 1.x (or 0.x) value represented by the latter bit-pattern without the implicit leading digit implied by the exponent.. Do you have a source for that? I can't recall seeing any writing that made that distinction. As I said in my answer, most people use the same term for both concepts, whichever term they prefer. (So even if there are formal definitions somewhere (in the IEEE standard?), most usages of the terms don't follow that.) $\endgroup$ Commented Jun 12, 2022 at 18:56
  • $\begingroup$ @PeterCordes I'm using the same terminology as Wikipedia. “Mantissa” and “significand” are only de facto synonyms in base 2 — which is typically an implicit assumption when discussing floating point representations on computers. $\endgroup$ Commented Jun 12, 2022 at 20:46
10
$\begingroup$

They're used as synonyms in the context of floating point math, but "mantissa" is less correct mathematically.

It's fewer syllables, easier to type, and starts with a different letter than Sign or Exponent, so many people including myself still prefer it, despite what Kahan and Knuth have to say. (Also including Intel, in naming the AVX512 instruction vgetmantpd for example, as a partner for vgetexppd which are convenient for exp/log implementations.)


Either / both get used as names for the part that isn't the sign bit or the exponent field. Or the value represented by that field, as opposed to the bits of the encoding. Wikipedia's articles on single-precision binary32 (float), and double, and IEEE FP formats in general, are very good.

Gilles's answer suggests that the two terms could make a distinction between the 1.x value represented vs. the bit-pattern or encoding, but I don't think that usage is common; I've never come across it.

For example, a single-precision binary32 FP converter (with a nice UI and display of the bits) names the field "Mantissa", and shows both the binary bit-pattern and the 1.x or 0.x value it represents (depending on the leading 1 or 0 implied by the exponent field for a normalized or subnormal float).

Wikipedia's Significand article describes the fact that they're used synonymously. But has a section at the end about why "mantissa" isn't quite the right mathematical meaning for FP math, since the significand is linear with only the exponent field being exponential. Unlike in earlier use of mantissa for log tables.

The significand (also mantissa or [other names]) is part of a number in scientific notation or in floating-point representation, consisting of its significant digits. Depending on the interpretation of the exponent, the significand may represent an integer or a fraction.

Terminology

The term significand was introduced by George Forsythe and Cleve Moler in 1967 and is the word used in the IEEE standard. However, in 1946 Arthur Burks used the terms mantissa and characteristic to describe the two parts of a floating-point number (Burks et al.) and that usage remains common among computer scientists today.

Mantissa and characteristic have long described the two parts of the logarithm found on tables of common logarithms. While the two meanings of exponent are analogous, the two meanings of mantissa are not equivalent. For this reason, the use of mantissa for significand is discouraged by some including the creator of the standard, William Kahan and prominent computer programmer and author of The Art of Computer Programming, Donald E. Knuth.

The confusion is because scientific notation and floating-point representation are log-linear, not logarithmic. To multiply two numbers, given their logarithms, one just adds the characteristic (integer part) and the mantissa (fractional part). By contrast, to multiply two floating-point numbers, one adds the exponent (which is logarithmic) and multiplies the significand (which is linear).

$\endgroup$
3
  • 4
    $\begingroup$ starts with a different letter than Sign or Exponent Ain't that the truth! If you want to write pedantically-correct code, it's quite a pain, because not only do Sign and Significand not differ in the first character, they don't differ in the first four characters. I've managed to make the switch to using "significand" in prose, because I agree it really is more correct, but my code tends to still use "mantissa". $\endgroup$ Commented Jun 12, 2022 at 11:58
  • $\begingroup$ You should upgrade to a compiler that treats more than the first 4 characters in an identifier as significant, @Steve! Even the ISO standard gives you 6 characters. $\endgroup$
    – Cody Gray
    Commented Jun 12, 2022 at 12:16
  • 1
    $\begingroup$ @SteveSummit: For a while I was writing "significand" in SO answers about floating point, but didn't like it, and eventually decided it's just a name, regardless of the mathematical origins being sloppy. I use "mantissa" intentionally, with an awareness that it's not mathematically precise, but that it's also universally understood in the context of IEEE floating point. And that its usage is unlikely to confuse anyone about the fact that floating point math has a linear part and a shift count (exponent). Like fixed-point, but with an exponent field to tell you where the radix point goes. $\endgroup$ Commented Jun 12, 2022 at 19:04
3
$\begingroup$

Strictly speaking, a mantissa is part of a logarithm (specifically a common logarithm). For example, the common (base-10) logarithm of 1234 is 3.09132. From that number 3.09132 we can immediately see that we're dealing with a number between 103 = 1000 and 104 = 10000. And then the .09132 part essentially gives us the rest of the digits.

When working with such logarithms, .09132 is the mantissa and 3 is the characteristic. This is useful because multiplications and divisions by 10 change the characteristic but not the mantissa. For example, we immediately know that the logarithm of 123.4 is 2.09132, and that the logarithm of 1.234 is 0.09132.

In fact, back in the day when people used log tables to do higher-order arithmetic, those log tables didn't bother to give you the logarithm of every number. They just told you that 1234 had a mantissa of 09132, and it was your job to figure out the characteristic, based on whether you knew you started with 1234, or 1.234, or 1234000, or some other magnitude of number. (There was also a funny convention for numbers less than 1. Mathematically, the logarithm of 0.1234 is -0.90868, which doesn't have .09132 in it, until you realize that 0.09132 - 1 = -0.90868. Using the log tables, you said that the logarithm of 0.1234 had a mantissa of .09132 and a characteristic of -1, which was often written as 1̅.09132. If your browser didn't render that correctly, there's an overbar over the leading 1, indicating that it's negative, but the mantissa is still positive.) You can read more about this at the Wikipedia article on common logarithm.

So that's the story behind "mantissa". The significand, on the other hand, is simply one part of the representation of a number in scientific notation (aka exponential notation). If we say 1234 = 1.234 × 103, we've got a significand of 1.234 and an exponent of 3. In IEEE 754, in binary, if we have 57.375 = 42658000 = 0b1.11001011 × 25, we've got a significand of 0b1.11001011 (or 0b0.11001011 without the implicit leading 1 bit) and an exponent of 5.

So a mantissa is something you can add an integer to in order to get the logarithm of the number you're interested in; it's the fractional part of the logarithmic representation of a number. A significand is something you can multiply by a power of the base in order to get the number you're interested in; it's the normalized part of a scientific or exponential notation.

So mantissa and significand really are two pretty different things. It's unfortunate, I suppose, that Burks started using "mantissa" in the context of floating point, because that term really caught on, and it's what pretty much everyone learns.

This is also explained in the "Terminology" section of the Wikipedia article on Significand.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.