1
$\begingroup$

I am doing some mathematics, and I am currently stuck on something. I do not understand this part at all, expressing the result in normalized binary exponential form, the book also mentions characteristics and exponent bias. An example from the book:

Find the 32-bit computer representation of $-1873.42$, where 8 bits are used for the characteristics, and the exponent bias is $2^7 - 1$.

Solution:

$$-1873.42_{10} = -1101010001.011010111000_2$$

Express the result in normalized binary exponential form:

$$-11101010001.011010111000_2 = -0.11101010001011010111000 \times 2^{11}$$

  • Sign bit: 1
  • Characteristic: $10001010$
  • Computer representation:

$$11000101\enspace01110101\enspace00010110\enspace10111000_2$$

Does someone here possibly know how these steps are performed to arrive at this? I am unable to find this in the book and I also Googled and went to YouTube. Finally, I decided to post here in the hopes of some light.

Reference:

  • Discrete Mathematics for Computing, 3rd Edition by Peter Grossman
$\endgroup$

1 Answer 1

1
$\begingroup$

A binary representation of $1873_{10}$ is \begin{align*} 1873_{10}&=\color{blue}{111\,0101\,0101_{2}}\\ \\ 1873&=2^{10}+2^9+2^8+2^6+2^4+2^2+2^0\tag{1}\\ &=1024+512+256+64+16+4+1 \end{align*} A binary representation of $0.42_{10}$ using $12$ binary digits is, using a truncated representation \begin{align*} 0.42_{10}&\doteq \color{blue}{0.0110\,1011\,1000_2}\\ &=\frac{1}{4}+\frac{1}{8}+\frac{1}{32}+\frac{1}{128}+\frac{1}{256}+\frac{1}{512}\tag{2}\\ &=0.419\,921\,875 \end{align*} Note that $0.0110\,1011\,100\color{blue}{1}_2>0.42_{10}$.

From (1) and (2) we obtain the representation \begin{align*} \color{blue}{-1873.42_{10}=-111\,0101\,0101.0110\,1011\,1000_2}\tag{3} \end{align*} We want a normalized representation such that the significand is a fractional part. From (3) we obtain the normalised representation \begin{align*} \color{blue}{-1873.42_{10}=-0.111\,0101\,0101\,0110\,1011\,1000_2\times 2^{11}}\tag{4} \end{align*} Here we multiply the right-hand side by $2^{11}$ to compensate for the shift of the significand by $11$ digits.

We have now in (4) for the fractional part $23$ bits out of $32$ in use. One sign bit $b_0$ and eight bits $b_1\ldots b_8$ for the exponent are left.

  • We use the most significant bit $b_0$ as sign bit and set it to $1$ to indicate the minus sign of $-1873.42_{10}$.

  • We use bits $b_1b_2\ldots b_8$ as exponent. The exponent is biased by $2^7-1=127$. We therefore use due to the exponent $11$ from (4) \begin{align*} (11+127)_{10}=138_{10}=128_{10}+8_{10}+2_{10}\color{blue}{=1000\,1010_2}\tag{5} \end{align*}

Putting finally sign bit $b_0$, the exponent from (5) and the fractional part (4) together we obtain the $32$ bit representation \begin{align*} \color{blue}{1100\,0101\,0111\,0101\,0101\,0110\,1011\,1000} \end{align*}

$\endgroup$
7
  • $\begingroup$ How do you know what exponent to use? $\endgroup$ Commented Jul 24, 2023 at 17:30
  • 1
    $\begingroup$ @AlixBlaine: If the number is not equal to zero, the significand contains at least one digit $1$. We shift the number such that the fractional binary part starts with $1$, in this case we shift the number by $11$ digits. $\endgroup$ Commented Jul 24, 2023 at 17:52
  • $\begingroup$ Aha, so the 11 in the exponent is actually the length of the shift. How do you determine this? $\endgroup$ Commented Jul 24, 2023 at 19:50
  • $\begingroup$ @AlixBlaine: This shift is performed until the first bit to the right of the decimal point is $1$ and there are no $1$ left of the decimal point. $\endgroup$ Commented Jul 24, 2023 at 19:56
  • $\begingroup$ I have seen shifts by 10 for example. $\endgroup$ Commented Jul 24, 2023 at 20:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .