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?

More than 5 years have passed since last update.

2進数の、1の補数 と 2の補数

0
Last updated at Posted at 2019-04-07

参考サイト:
http://proengineer.internous.co.jp/content/columnfeature/6254

はじめに

理屈は抜きにして、どうすれば2進数の1の補数と2の補数を求めることができるのかだけ書くよ。
補数って何?補数を使うとどんないいことがあるの?って方は、こちらをご参照ください。

2進数の、1の補数の求め方

1の補数にする前の数を7桁の2進数「1001101」とします。
2進数の1の補数は、元の数の0と1を反転すればよい。
つまり……

元数:1001101
補数:0110010

これでいいのだ。

2進数の、2の補数の求め方

先程と同じく、元の数を7桁の2進数「1001101」とします。
2進数の1の補数は、1の補数に1を加算すればよい。
つまり……

元数:1001101
補数:011001

これでいいのだ。

0
0
2

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?