Fractional Numbers
- Remember in a positional number system with base b.
- $d_1d_2d_3.d_4d_5d_6 = d_1 \times b^2 + d_2 \times b^1 + d_3 \times b^0 + d_4 \times b^{-1} + d_5 \times b^{-2} + d_6 \times b^{-3}$
- We will need to convert between fractions in different bases.
- Convert .1875 to binary
- A brute force method is to continue to subtract negative powers of two until we reach 0 or the accuracy we want.
2-1 = 1/2 or .5 This is larger than .1875 so record .0 2-2 = 1/4 or .25 This is larger than .1875 so record .00 2-3 = 1/8 or .125 This is smaller than or equal to .1875 so record .001 Subtract .1875 - .125 ------ .0625 2-4 = 1/16 or .0625 This is smaller than or equal to .0625 so record .0011 Subtract .0625 - .0625 ------- 0 .1875 = .00112
- A brute force method is to continue to subtract negative powers of two until we reach 0 or the accuracy we want.
- A second method is to multiply by 2 and record any 1s
.1875 x 2 = .375 record 0 .375 x 2 = .75 record 0 .75 x 2 = 1.5 record 1 .5 x 2 = 1.0 record 1 stop, read down .1875 = .00112 - We can process other bases the same way.
- To decimal:
- Just expand the digit * weight
- Convert .14527 to decimal
- 1 × 7-1 + 4 × 7-2 + 5 × 7-3 + 2 × 7-4 = .2399
- From decimal
- Multiply by the base
- The integer part becomes the digit
- Convert .6012 to base 15
-
.6012 * 15 = 9.018 so record .9 .018 * 15 = 0.27 so record .90 .27 * 15 = 4.05 so record .904 .05 * 15 = 0.75 SO record .9040
-
- To decimal: