### Binary Number System: Representations

IEEE 32-Bit Floating Point Format - Homework solutions

```HOMEWORK PROBLEM SOLUTIONS

1.  Convert the decimal number 1234.53125 to an IEEE float number.

a.  expressed in binary

1234.53125

First the integer portion:

1234 / 2 = 617 rem 0 <-- list the remainders, in reverse order: 0
= 308 rem 1     10
= 154 rem 0     010
=  77 rem 0     0010
=  38 rem 1     10010
=  19 rem 0     010010
=   9 rem 1     1010010
=   4 rem 1     11010010
=   2 rem 0     011010010
=   1 rem 0     0011010010
=   0 rem 1     10011010010

1234 = 10011010010

Next, the fractional portion:

0.53125 x 2  = 1.0625  <-- list the integer portion, beginning here: 0.1
0.0625  x 2  = 0.125       0.10
0.125   x 2  = 0.25        0.100
0.25    x 2  = 0.5         0.1000
0.5     x 2  = 1.0         0.10001
0.0                        Stop, when the fractional result equals 0

0.53125 = 0.10001

Thus,

1234.53125 = 10011010010.10001

Normalizing: 1.001101001010001 x 210

s = 0, for positive number, 1 for negative.

e = 10; encode e + 127 = 137 = 10001001

f = 001101001010001

pad f to the right to make 23 bits: 00110100010100010000000

Assemble:

s   e + 127    f
0 | 10001001 | 00110100101000100000000

==> 01000100100110100101000100000000

b.  expressed in hexadecimal

0100 0100 1001 1010 0101 0001 0000 0000

= 449A5100

2.  What is the decimal equivalent of the IEEE float number 447A3400 (expressed in hexadecimal)?

447A3400

0100 0100 0111 1010 0011 0100 0000 0000

divide into s, e+127 and f:

0 | 10001000 | 11110100011010000000000

s = 0; positive number

e+127 = 10001000 = 136; therefore, e = 136-127 = 9, giving 1.1111010001101 x 29

= 1111101000.1101

= 1111101000 + 0.1101

= 1000 + fraction

(Note that the answer is the decimal number one thousand, not the binary number 1000)

fraction = 1/2 + 1/4 + 1/16 = 0.8125

Thus the answer is:

1000.8125

3.  Express the ASCII string "Done" in hexadecimal.

A is 41; a is 61

"Done" = 446F6E65

4.  Consider the hexadecimal value AABBCCDD

a.  How many bits does this value require?

Each hex digit is 4 bits, thus 4 x 8 = 32 bits.

b.  If this represents a string of ASCII characters, how many characters are in the string?

Each ASCII character is 8 bits, thus 32 / 8 = 4 characters.

c.  If this represents a 32-bit IEEE Float value, is the value positive or negative?

A = 1010, so the first bit is a 1 which, in IEEE Float, means the value is negative.

d.  If this represents a 32-bit IEEE Float value, written in the form:

±1.bbbbbb...bbb x 2e

what is the value of e?

Look at the first 12 bits: AAB = 101010101011.
The first bit is the sign bit; drop it off: 01010101011
The exponent only uses eight bits, so take the first eight: 01010101

The 8 bit e+127 value is 01010101 = 85 in decimal.
So e+127 = 85.
Thus, e = 85-127 = -42

e.  How can we determine whether this represents a string, an IEEE float, or something else?

Only by the context of the problem.  It's just bits until we decide what the bits will mean.

```