Skip to main content
  1. Posts/

2進数の解釈方法まとめ

·100 words·1 min
Binary

2 進数の解釈方法[Unsigned binary, 1’s complement, 2’s complement, Signed Magnitude, BCD]
#

コンピューターが 2 進数を解釈するとき、2 つの情報が必要らしい。だから go 言語とかは uint64 とかでその数字がどう解釈されるかを指定しているのかな?

“the software must know two things before it can interpret a binary value:
the number of bits and the type of binary representation being used."(Tarnoff, 2007)

例えば、1001は Unsigned binary だと 9 だが、 2’s complement では -7 である。
解釈方法は以下の種類がある。

  • Unsigned Binary
  • 1’s complement
  • 2’s complement
  • BCD (Binary Coded Decimal)

Reference
#

Tarnoff, D. L. (2007). Computer organization and design fundamentals: Examining computer hardware from the bottom to the top (pp. 52–70).