54.8k views
1 vote
Show the IEEE754 single-precision representation of the decimal number 23.45. Show your work and indicate the three parts of the representation.

1 Answer

3 votes

Answer:

Sign: 0 (a positive number)

Exponent (unadjusted): 4

Mantissa (not normalized): 1.0111 0111 0011 0011 0011 0011 0011

Explanation:

First, convert to base 2 the integer part: 23.

Continue dividing the number by 2, noting each remainder, until we get a quotient that is equal to zero.

23 ÷ 2 = 11 remainder 1

11 ÷ 2 = 5 remainder 1

5 ÷ 2 = 2 remainder 1

2 ÷ 2 = 1 remainder 0

1 ÷ 2 = 0 remainder 1

Take all the remainders starting from the bottom

So 23 = 1 0111 in base 2

Then, convert to base 2, the fractional part: 0.45.

Continue multiply the number by 2, noting each integer part of the results, until we get a fractional part that is equal to zero:

0.45 × 2 = 0 + 0.9;

0.9 × 2 = 1 + 0.8;

0.8 × 2 = 1 + 0.6;

0.6 × 2 = 1 + 0.2;

0.2 × 2 = 0 + 0.4;

0.4 × 2 = 0 + 0.8;

0.8 × 2 = 1 + 0.6;

0.6 × 2 = 1 + 0.2;

0.2 × 2 = 0 + 0.4;

0.4 × 2 = 0 + 0.8;

0.8 × 2 = 1 + 0.6;

0.6 × 2 = 1 + 0.2;

0.2 × 2 = 0 + 0.4;

0.4 × 2 = 0 + 0.8;

0.8 × 2 = 1 + 0.6;

0.6 × 2 = 1 + 0.2;

0.2 × 2 = 0 + 0.4;

0.4 × 2 = 0 + 0.8;

0.8 × 2 = 1 + 0.6;

0.6 × 2 = 1 + 0.2;

0.2 × 2 = 0 + 0.4;

0.4 × 2 = 0 + 0.8;

0.8 × 2 = 1 + 0.6;

0.6 × 2 = 1 + 0.2

We didn't get any fractional part that was equal to zero.

But we've had enough iterations and at least one integer that was different from zero.

We start our decimal representation from the top

0.45 = 0.0111 0011 0011 0011 0011 0011 base 2

Beore normalization:

23.45 = 1 0111.0111 0011 0011 0011 0011 0011 base 2

After normalization

23.45 = 1. 0111 0111 0011 0011 0011 0011 0011 base 2

Normalize here means shifting the decimal mark 4 positions to the left so that only one non zero digit remains to the left of it

Sign: 0 (a positive number)

Exponent (unadjusted): 4

Mantissa (not normalized): 1.0111 0111 0011 0011 0011 0011 0011

User Kachina
by
3.9k points