Jump to content

Binary coding

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by 4.60.73.75 (talk) at 09:42, 27 November 2002 (added ones' complement, sign magnitude). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Binary coding is the term used to describe how information, normally numbers, are stored in binary, radix-2 form.

The conventional mathematical way is described in the article about binary, however to electronic purposes different ways of encoding numbers are used for efficiency or practical reasons.

Coding systems include:

  • Binary-Coded Decimal : Each digit of decimal is encoded as a 4-bit binary number. The digits are then individually decoded to form a decimal number. This system is most commonly used in calculators.
  • Two's Complement : The number is encoded so negative numbers start with a 1, then all other 1's are subtracted. Eg. 11112=-110. This useful for arithmetic with binary and allows greater flexiblity when dealing with both positive and negative integers.
  • Ones' Complement : The number is encoded such that a negative number is stored as its positive counterpart inverted. E.g., 11102 = -110 since NOT 00012 = 11102. Ones' complement notation has the side-effect of being able to represent +0 and -0. The UNIVAC 1100stored numbers using ones' complement, but it is rarely used in present times.
  • Sign Magnitude : The most-significant bit of the number is set to 0 if positive, 1 if negative. Multiplication is somewhat easier than as with two's or ones' complement, however addition and subtraction requires more work.

See also: