> 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.83-binary-floating-value.md).

# 2.83 Binary Floating Value

★★

**Problem**:

Consider numbers having a binary representation consisting of an infinite string of the form 0.yyyy..., where y is a k-bit sequence. For example, the binary representation of 1/3 is 0.01010101...(y=01), while the representation of 1/5 is 0.001100110011...(y=0011).

A. Let Y=B2Uk(y), that is, the number having binary representation y. Give a formula in terms of Y and k for the value represented by the infinite string. **Hint:** Consider the effect of shifting the binary point k positions to the right.

```
n=0.yyyyyyy...
n<<k=y.yyyyy...=Y+n
(n<<k)-n=Y
n*2^k-n=Y
n=Y/(2^k-1)
```

B. What is the numeric value of the string for the following values of y?

(a) 101

Y=5, k=3, n=5/7

(b) 0110

Y=6, k=4, n=6/15=2/5

(c) 010011

Y=19, k=6, n=19/63
