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?

1の補数 2の補数

Posted at

結論

2進数において、

1の補数は、ある数に足して各桁を1にするのために必要な数で、"1"の補数
例) 0011 の補数は 1100 → 0011 + 1100 = 1111

2の補数は、ある数に足して繰り上がる数で、"2(2進数では繰り上がる数)"の補数
例) 0011 の補数は 1101 → 0011 + 1101 = 10000

もう少し細かく

2進数において、1 と 2 という数がどのような数であるか、見てみましょう。

1 → 各桁における最高値
2 → 繰り上がりの数字

つまり、
1の補数を言い換えると
各桁を最高値とするために必要な数

2の補数を言い換えると
繰り上がるために必要な数
となるわけです。

一般化

n進数において、

nの補数は繰り上げるための数

n-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?