程序代写代做代考 computer architecture Solutions8

Solutions8

Computer Architecture

Tutorial 4 – Floating Point Numbers – Answers

1) Binary fractions are:

a) 5.5 is 101.1

b) 8.25 is 1000.01

c) 9 is 1001

0.3  0.6, 1.2, 0.4, 0.8, 1.6, 1.2  01001 1001 1001 etc.

9.3 is 1001. 01001 1001 1001 repeating etc.

d) 11.46875 is 1011.01111

2) Convert the binary number 1001.1010101 to decimal.

1001 binary is 9 decimal

. 1 0 1 0 1 0 1

128 64 32 16 8 4 2 1 Sum=85

Fraction = 85 /128 = 0.6640625

Number = 9.6640625

3) a) 101.1 = 1.011 x 2
2

b) 1000.01 = 1.00001 x 2
3

c) 0.00010101 = 1.0101 x 2
–4

4) Convert –31.3 to IEEE Single Precision format.

First convert to a binary number -31.3 = -11111.01001 1001 1001

Next Normalise

1.11110 1001 1001 1001 1001 1001 x 2
4

Significand field is 1111 0100 1100 1100 1100 110 (23 bits with 1. omitted)

Exponent field is 4+127 = 131 = 1000 0011

Number is -ve therefore Sign field is 1

Sign Exponent Significand

1 1000 0011 1111 0100 1100 1100 1100 110

5) Convert the IEEE Single Precision format hex value C154 0000 to decimal.

C154 0000 = 1100 0001 0101 0100 0000 0000 0000 00000

Sign Exponent Significand

1 1000 0010 1010 1000 0000 0000 0000 000

Exponent field = 1000 0010 = 130 => Exponent = 130 – 127 = 3

Significand field = 10101 Adding Hidden Bit => 1.10101

Therefore number is 1.10101 x 2
3

= 1101.01 = Decimal 13.25

Sign is 1 therefore number is -13.25

6) Carry out the operation 31.3 + 13.25 in IEEE single precision arithmetic

Number Sign Exponent Significand

31.3 0 1000 0011 1111 0100 1100 1100 1100 110

13.25 0 1000 0010 1010 1000 0000 0000 0000 000

Significand of Larger Number = 1.1111 0100 1100 1100 1100 110

Significand of Smaller Number= 1.1010 1000 0000 0000 0000 000

Exponents differ by 1. Therefore shift binary point of Smaller Number 1 place.

Significand of Larger Number = 1.1111 0100 1100 1100 1100 1100

Significand of Smaller Number= 0.1101 0100 0000 0000 0000 0000

Significand of Sum = 10.1100 1000 1100 1100 1100 1100

Sum = 10.1100 1000 1100 1100 1100 1100 x 2
4

Normalise 1.01100 1000 1100 1100 1100 1100 x 2
5

Sign Exponent Significand

0 1000 0100 0110 0100 0110 0110 0110 011

7)

Fraction Binary Decimal

1/4 0.01 0.25

3/8 0.011 0.375

23/16 1.0111 1.4375

45/16 10.1101 2.8125

11/8 1.011 1.375

45/8 101.101 5.625

49/16 11.0001 3.0625