Converting fractional portion of a number to binary. Assume 8 bits of data storage.
Decimal.Decimal to binary
.431 .431 c . 0.862 c 0 1.724 c 1 1.448 c 1 0.896 c 0 1.792 c 1 1.584 c 1 1.168 c 1 0.336 c 0 .01101110b |
  |
Binary to Decimal.Decimal
0.01101110 sum= 0 0 * .5 + 0 1 * .25 + 0 1 * .125 + 0.25 0 * .0625 + 0.375 1 * .03125 + 0.40625 1 * .015625 + 0.421875 1 * .0078125 + 0.4296875 0 * .00390625 + 0.4296875 sum= 0.4296875 |
|
Note the difference between values 0.431 - 0.4296875 = .0013125 (.3% difference) |
||