2進法

2進法

ある10進数が \[ \sum_{k}d_k2^k=\cdots+d_12^1+d_02^0+d_{-1}2^{-1}+\cdots \] と書けるとき、この10進数は2進数で \[ \cdots d_2d_1d_0.d_{-1}d_{-2}\cdots_{(2)} \] と表される。

例えば10進数の25であれば \[ 25=1\cdot2^4+1\cdot2^3+0\cdot2^2+0\cdot2^1+1\cdot2^0 \] であるから \[ 25=11001_{(2)} \] となる。

また、10進数の6.75であれば \[ 6.75=1\cdot2^2+1\cdot2^1+0\cdot2^0+1\cdot2^{-1}+1\cdot2^{-2} \] であるから \[ 6.75=110.11_{(2)} \] となる。

演習問題

例題