Question

2. Convert the following real numbers into single precision IEEE floating point format. Give the final answer in hexadecimal and specify: the sign bit, exponent bits, and significand bits. Show your work. (10 + 10 points) A. 69.625 B. -123.7 the following IEEE single precision floating point numbers. Show your work. (10 + 10 points) A. 0xc1be0000 B. 0x42c68000

0 0
Add a comment Improve this question Transcribed image text
Answer #1

2.

A. 69.625

First i am converting decimal to 32 bit single precision IEEE binary floating point.

in 32 bits: 1st bit for sign,next 8 bits for exponent,next 23 bits for mantissa

First converting 69 to binary:

we divide number by 2 and write quotient,remainder a side.

then repeat the process by dividing quotient by 2 and write quotient,remainder a side.

repeat process until quotient is 0.

69 ÷ 2 = 34 (quotient), remainder 1;

34 ÷ 2 = 17 (quotient), remainder 0;

17 ÷ 2 = 8 (quotient), remainder 1;

8 ÷ 2 = 4 (quotient), remainder 0;

4 ÷ 2 = 2 (quotient), remainder 0;

2 ÷ 2 = 1 (quotient), remainder 0;

1 ÷ 2 = 0 (quotient), remainder 1;

quotient is 0. so take the remainders in reverse order (100 0101)2.

Next convert fractional decimal into binary:

0.625:

Process : multiply fractional part with 2 continuously , write the integer part a side. Next repeat this process with new fractional part until the fractional part becomes 0.

0.625 × 2 = 1 (integer part), new fractional part 0.25;

0.25 × 2 = 0 (integer part), new fractional part 0.5;

0.5 × 2 = 1 (integer part), new fractional part 0;

take the integer parts from top to bottom (101)2

total number 69.625 = 100 0101.1012

Normalizing binary number:

shift the decimal point to left so that only one non zero digit will be left before decimal point:

Normalized the binary number = 1.000101101 X 26

up to this we have

sign bit : 0 positive number

exponent : 6 (unadjusted)

mantissa : 1.000101101

But as specified, exponent is of 8 - bits, so we need to adjust the exponent so that it will have 8 bits

We have a formula : Exponent adjusted =  Exponent unadjusted + 2(8-1) (8 is the no of bits in exponent) - 1

= 6 + 127 -1

= 13310

now convert 133 to binary number :

33 ÷ 2 = 66 (quotient), remainder 1;

66 ÷ 2 = 33 (quotient), remainder 0;

33 ÷ 2 = 16 (quotient), remainder 1;

16 ÷ 2 = 8 (quotient), remainder 0;

8 ÷ 2 = 4 (quotient), remainder 0;

4 ÷ 2 = 2 (quotient), remainder 0;

2 ÷ 2 = 1 (quotient), remainder 0;

1 ÷ 2 = 0 (quotient), remainder 1;

writing in reverse order 133 = 1000 01012

Now Normalizing the mantissa, Remove the 1 to left of decimal and adjust the binary number so that it contains 23 bits

Normalized mantissa : 000101101000000000000002

Overall binary representation is:

69.62510 = 0 10000101 000101101000000000000002 (1st bit is sign bit, next 8 are exponent, next 23 are mantissa)

sign bit 0 means it is positive number

1 means it is negative number

binary Hexa decimal
0000 0
0001 1
0010 2
0011 3
0100 4
0101 5
0110 6
0111 7
1000 8
1001 9
1010 A
1011 B
1100 C
1101 D
1110 E
1111 F

Converting it into HEXA DECIMAL: ox428B4000 FROM TABLE

b.-123.7510

First i am converting decimal to 32 bit single precision IEEE binary floating point.

in 32 bits: 1st bit for sign,next 8 bits for exponent,next 23 bits for mantissa

First converting |-123| (take mod) to binary:

we divide number by 2 and write quotient,remainder a side.

then repeat the process by dividing quotient by 2 and write quotient,remainder a side.

123 ÷ 2 = 61 (quotient), remainder  1;

61 ÷ 2 = 30 (quotient), remainder 1;

30 ÷ 2 = 15 (quotient), remainder 0;

15 ÷ 2 = 7 (quotient), remainder 1;

7 ÷ 2 = 3 (quotient), remainder  1;

3 ÷ 2 = 1 (quotient), remainder 1;

1 ÷ 2 = 0 (quotient), remainder 1;

123 = 111 10112

Next convert fractional decimal into binary:

0.75:

Process : multiply fractional part with 2 continuously , write the integer part a side. Next repeat this process with new fractional part until the fractional part becomes 0.

0.75 × 2 = 1 (integer part), new fractional part 0.5

0.5 × 2 = 1 (integer part), new fractional part 0

0.7510  = 112

total number 123.7510 = 111 1011.112

Normalizing the binary number:

shift the decimal point to left so that only one non zero digit will be left before decimal point:

Normalized binary number = 1.11 101111 X 26

up to this we have

sign bit : 1 so it is negative number

exponent : 6 (unadjusted)

mantissa : 1.11 101111

But as specified exponent is of 8 - bits, we need to adjust the exponent so that it will have 8 bits

We have a formula : Exponent adjusted =  Exponent unadjusted + 2(8-1) (8 is the no of bits in exponent) - 1

= 6 + 127 -1

= 13310

now convert 133 to binary number :

33 ÷ 2 = 66 (quotient), remainder 1;

66 ÷ 2 = 33 (quotient), remainder 0;

33 ÷ 2 = 16 (quotient), remainder 1;

16 ÷ 2 = 8 (quotient), remainder 0;

8 ÷ 2 = 4 (quotient), remainder 0;

4 ÷ 2 = 2 (quotient), remainder 0;

2 ÷ 2 = 1 (quotient), remainder 0;

1 ÷ 2 = 0 (quotient), remainder 1;

writing in reverse order 13310 = 1000 01012

Now Normalizing the mantissa, Remove the 1 to left of decimal and adjust the binary number so that it contains 23 bits.

Normalized mantissa : 11 1011110000000000000002

Overall binary representation is:

-123.7510 = 1 10000101 111011110000000000000002 (1st bit is sign bit, next 8 are exponent, next 23 are mantissa)

sign bit 0 means it is positive number

1 means it is negative number

Converting it into HEXA DECIMAL: oxC2F78000 (for every 4 bits)

3.

a. 0xc1be0000

Converting it to binary from table :

1 10000011 011111000000000000000002

1 - sign bit (so negative number)

10000011 -exponent

01111100000000000000000 - mantissa

Converting the binary to decimal for exponent:

multiply the bits from left side with their 2position number (position number starts from 0), add the all numbers

100000112 : 1 × 27 + 0 × 26 + 0 × 25 + 0 × 24 + 0 × 23 + 0 × 22 + 1 × 21 + 1 × 20 = 128 + 0 + 0 + 0 + 0 + 0 + 2 + 1=13110

As in the previous example we have adjusted the exponent, here also same thing ,

we need to subtract 131 from (2(8-1) (8 is the no of bits in exponent) - 1) (reverse process to the 2nd problems)

131-127 = 4 (adjusted exponent)

Convert mantissa to decimal :

011111000000000000000002 = 0 × 2-1 + 1 × 2-2 + 1 × 2-3 + 1 × 2-4 + 1 × 2-5 + 1 × 2-6 + 0 × 2-7 + 0 × 2-8 + 0 × 2-9 + 0 × 2-10 + 0 × 2-11 + 0 × 2-12 + 0 × 2-13 + 0 × 2-14 + 0 × 2-15 + 0 × 2-16 + 0 × 2-17 + 0 × 2-18 + 0 × 2-19 + 0 × 2-20 + 0 × 2-21 + 0 × 2-22 + 0 × 2-23 =  

0 + 0.25 + 0.125 + 0.062 5 + 0.031 25 + 0.015 625 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 =

= 0.484 375(10)

Formula for converting binary to decimal : (-1)Sign bit × (1 + mantissa) × 2(adjusted Exponent )

= (-1)1 × (1 + 0.484 375) × 24 = - 23.7510

final answer is 0xc1be0000 = - 23.7510

b. 0x42c68000

Converting it to binary :

0 10000101 10001101000000000000000

0 - sign bit (so positive number)

10000101 -exponent

10001101000000000000000 - mantissa

Converting the binary to decimal for exponent:

multiply the bits from left side with their 2position number (position number starts from 0), add the all numbers

100001012 : 1 × 27 + 0 × 26 + 0 × 25 + 0 × 24 + 0 × 23 + 1 × 22 + 0 × 21 + 1 × 20 = 13310

As in the previous example (2nd problem) we have adjusted the exponent, here also same thing ,

we need to subtract 133 from (2(8-1) (8 is the no of bits in exponent) - 1) (reverse process to the 2nd problems)

133-127 = 6 (adjusted exponent)

Convert mantissa to decimal :

1 × 2-1 + 0 × 2-2 + 0 × 2-3 + 0 × 2-4 + 1 × 2-5 + 1 × 2-6 + 0 × 2-7 + 1 × 2-8 + 0 × 2-9 + 0 × 2-10 + 0 × 2-11 + 0 × 2-12 + 0 × 2-13 + 0 × 2-14 + 0 × 2-15 + 0 × 2-16 + 0 × 2-17 + 0 × 2-18 + 0 × 2-19 + 0 × 2-20 + 0 × 2-21 + 0 × 2-22 + 0 × 2-23

= 0.5 + 0 + 0 + 0 + 0.031 25 + 0.015 625 + 0 + 0.003 906 25 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0

100011010000000000000002 =0.550 781 2510

Formula for converting binary to decimal : (-1)Sign bit × (1 + mantissa) × 2(adjusted Exponent )

(-1)0 × (1 + 0.550 781 25) × 26

=1.550 781 25 × 26

=99.2510

final answer is 99.2510

Add a comment
Know the answer?
Add Answer to:
2. Convert the following real numbers into single precision IEEE floating point format. Give the final...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT