**Question:**

**Q.1. **Show how each of the following floating point values would be stored using the simple model described in the textbook (14-bit format, 5 bits for the exponent with a bias of 15, a normalized mantissa of 8 bits, and a single sign bit). Express your answer in both binary and hexadecimal:

22.5

-3.5

0.7625

25.325

**Answer:**

```
Decimal --> 22.5
Binary -> 01000001101101000000000000000000
Hexa decimal -> 0x41b40000
Decimal --> -3.5
Binary -> 11000000011000000000000000000000
Hexa decimal -> 0xc0600000
Decimal --> 0.7625
Binary -> 00111111010000110011001100110011
Hexa decimal -> 0x3f433333
Decimal --> 25.325
Binary -> 01000001110010101001100110011010
Hexa decimal -> 0x41ca999a
```

**Q.2.** What decimal floating point number does each of the following represent assuming it is stored using the simple model described in the textbook (14-bit format, 5 bits for the exponent with a bias of 15, a normalized mantissa of 8 bits, and a single sign bit). Express your answer in both scientific binary format and decimal format:

13A8

2D80

0FA0

1483

**Answer:**

```
Hexadecimal -> 13A8
Binary -> 00000000000000000001001110101000
Decimal -> 7.051E-42
Hexadecimal -> 2d80
Binary -> 00000000000000000010110110000000
Decimal -> 1.6322E-41
Hexadecimal -> 0F80
Binary -> 00000000000000000000111110100000
Decimal -> 5.605E-42
Hexadecimal -> 1483
Binary -> 00000000000000000001010010000011
Decimal -> 7.358E-42
```

**Q.3.** Assume we are using the simple model for floating-point representation as given in this book (the representation uses a 14-bit format, 5 bits for the exponent with a bias of 15, a normalized mantissa of 8 bits, and a single sign bit for the number):

Show how the computer would represent the numbers 100.0 and 0.25 using this floating-point format.

Show how the computer would add the two floating-point numbers in part a by changing one of the numbers so they are both expressed using the same power of 2.

Show how the computer would represent the sum in part b using the given floating point representation. What decimal value for the sum is the computer actually storing? Explain.

**Answer:**

**Q.4.** Let a = 1.0 × 29, b = − 1.0 × 29 and c = 1.0 × 21. Using the floating-point model described in the text (the representation uses a 14-bit format, 5 bits for the exponent with a bias of 15, a normalized mantissa of 8 bits, and a single sign bit for the number), perform the following calculations, paying close attention to the order of operations. What can you say about the algebraic properties of floating-point arithmetic in our finite model? Do you think this algebraic anomaly holds under multiplication as well as addition?

b + (a + c) =

(b + a) + c =

**Answer:**

```
a = 1.0 x 29 = 29.0
b = -1.0 x 29 = -29.0
c = 1.0 x 21 = 21
===> b + (a + c) => -29.0 + 50.0 ==> 21.0
Binary -> 01000001101010000000000000000000
Hexadecimal -> 0x41a80000
===> (b + a) + c => 0 + 21 ==> 21.0
Binary -> 01000001101010000000000000000000
Hexadecimal -> 0x41a80000
```

**Q.5.** Show how each of the following floating point values would be stored using IEEE-754 single precision. Express your answer in hexadecimal.

a) 22.5

b) −3.5

c) 0.7625

d) 25.325

**Answer:**

a) 22.5 –> 0x41b40000

b) −3.5 –> 0xc0600000

c) 0.7625 –> 0x3f433333

d) 25.325 –> 0x41ca999a