1
$\begingroup$

In The Scientist and Engineer's Guide to Digital Signal Processing By Steven W. Smith, Ph.D. i have read something like that,

Single precision or 32-bit floating point forms the floating point number, $v$, by the following relation: $$ v = (-1)^S \times M \times 2^{E-127} $$

The term: $(-1)^S$, simply means that the sign bit, $S$, is $0$ for a positive number and $1$ for a negative number. The variable, $E$, is the number between $0$ and $255$ represented by the eight exponent bits. Subtracting $127$ from this number allows the exponent term to run from to In other words, the exponent is stored in offset binary with an offset of $127$.

Everything I have understood but this,

Subtracting 127 from this number allows the exponent term to run from 128 to −127. In other words, the exponent is stored in offset binary with an offset of 127.

I need an easy to understand explanation of subtracting 127 from $E$ and binary offset.

$\endgroup$
2
$\begingroup$

Suppose you didn't include that shift of $127$, i.e. your number $\nu$ would have the form $\nu = (-1)^S \cdot M \cdot 2^x$ with $x$ being the exponent.

With $8$ bits for the exponent $x$ can have a value from $0$ to $255$. This means you can represent numbers from $\nu = (-1)^S \cdot M \cdot 2^0$ to $\nu = (-1)^S \cdot M \cdot 2^{255}$ .

However, what if you wanted $\nu$ to be $2^{-10}$? It would not be possible.

For this to be possible you want to allow negative exponents $x$. Instead of $x$ ranging from $0$ to $255$ you introduce a shift of 127 such that $x$ ranges from $-127$ to $+128$ .

Now you can represent numbers $\nu$ that range from $(-1)^S \cdot M \cdot 2^{-127}$ to $(-1)^S \cdot M \cdot 2^{+128}$ .

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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