Two-out-of-five code

From Wikipedia, the free encyclopedia

In telecommunication, a two-out-of-five code is a binary-coded decimal notation in which:

  1. each decimal digit is represented by a binary numeral consisting of five bits of which two are of one kind, called "ones," and three are of the other kind, called "zeros", and
  2. the usual weights assigned to the bit positions are 0-1-2-3-6. However, in this scheme, zero is encoded as "binary" 01100; strictly speaking the 0-1-2-3-6 previously claimed is just a mnemonic device.

Source: From Federal Standard 1037C

The U.S. Post Office POSTNET barcode uses a two-out-of-five code printed in long bars for "ones" and short bars for "zeros" to represent the ZIP+4 code for automated mail sorting and routing equipment. The weights assigned to the bit positions are: 7-4-2-1-0 (Though in this scheme, zero is encoded as 11, or "binary" 11000).

The IBM 7070, IBM 7072, and IBM 7074 computers used a two-out-of-five code. The bit positions were numbered 0-1-2-3-4, with no associated weights. The sign of a word could be A Alphameric, - Minus, or + Plus; using only bit positions 0-3-4.

The following table represents decimal digits from 0 to 9 in various two-out-of-five code systems:

Digit Telecommunication
01236
U.S. Post Office
74210
IBM 7070, 7072, 7074
01234
0 01100 11000 01100
1 11000 00011 11000
2 10100 00101 10100
3 10010 00110 10010
4 01010 01001 01010
5 00110 01010 00110
6 10001 01100 10001
7 01001 10001 01001
8 00101 10010 00101
9 00011 10100 00011
A N/A N/A 1––10
- N/A N/A 1––01
+ N/A N/A 0––11
In other languages