0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

補数を噛み砕く Part1

Last updated at Posted at 2025-04-21

コンピューターは引き算が出来ない。だから補数という概念を使って、足し算で引き算を完結させる。補数を足して桁を除けば引き算になる意味が分からなかった。なので、こちらで噛み砕きます。超初心者の噛み砕き場所なので、間違ってたらゴメンね。
5-3=2 3の補数10-3=7 5+7=12→2
これは5-(10-7)=5-10+7=5+7-10
だから補数を足して追加された桁を除けば大丈夫!
2進数でも同じ。0011-0001の場合、0011-(10000-1111)=0011+1111-10000=10010-10000=0010になる、
補数表現による1111 1111は-1。これは0000 0001の補数に該当するから。1111 1111に0000 0001を足すと1 0000 0000となり、結果ゼロになる。足してゼロになるという事はマイナス1に該当する、

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?