> For the complete documentation index, see [llms.txt](https://valineliu.gitbook.io/deuterium-wiki/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://valineliu.gitbook.io/deuterium-wiki/reading/cs-jing-dian-shu-ji/csapp-3e-homework-solution/2.-representing-and-manipulating-information/2.85-floating-point.md).

# 2.85 Floating Point I

★

**Problem**:

Given a floating-point format with a k-bit exponent and an n-bit fraction, write formulas for the exponenet E, significand M, the fraction f, and the value V for the quantities that follow. In addition, describe the bit representation.

Bias=2^(k-1)-1, V=2^E\*M

A. The number 7.0

7.0=0B111.0, M=0B1.11, f=0B.11, E=2, e=2+Bias=2+2^(k-1)-1=2^(k-1)+1, V=7.0

bits:

```
0 10...01 110...
```

B. The largest odd integer that can be represented exactly

M=0B1.11111..., f=0B.11111...(n bits 1), E=e-bias=n, so e=n+bias=n+2^(k-1)-1, V=0B1111...(n+1 bits 1)

bits:

```
0 bias+n 1111...
```

C. The reciprocal of the smallest positive normalized value

Smallest positive normalized value:

```
0 00...01 000...
```

e=1, bias=2^(k-1)-1, M=1, V=2^(1-bias)

reciprocal is:

V=2^(bias-1)

E=bias-1, M=1.0, f=0.0, e=E+bias=2bias-1=2^k-3

bits:

```
0 111...101 000...
```
