In telecommunication, a two-out-of-five code is an m of n code that provides exactly ten possible combinations, and thus is popular for representing decimal digits using five binary bits. An m of n code is a separable Error detection code with a code word length of n bits where each code word contains exactly m instances There are ways to assign weights to each bit such that the set bits sum to the desired value, with an exception for zero.
According to Federal Standard 1037C:
The weights give a unique encoding for most digits, but allow two encodings for 3: 0+3 or 10010 and 1+2 or 01100. The former is used to encode the digit 3, and the latter is used to represent the otherwise unrepresentable zero.
The IBM 7070, IBM 7072, and IBM 7074 computers used this code to represent each of the ten decimal digits in a machine word, although they numbered the bit positions 0-1-2-3-4, rather than with weights. IBM 7070 was a decimal architecture intermediate data processing system that was introduced by IBM in June 1960 The IBM 700/7000 series was a series of large scale ( mainframe) Computer systems made by IBM through The IBM 700/7000 series was a series of large scale ( mainframe) Computer systems made by IBM through Each word also had a sign flag, encoded using a two-out-of-three code, that could be A Alphanumeric, − Minus, or + Plus. When copied to a digit, the three bits were placed in bit positions 0-3-4.
A variant is the U.S. Post Office POSTNET barcode, used to represent the ZIP+4 code for automated mail sorting and routing equipment. Example The above-mentioned example of 55555-1237 yields Sum is 38 The check digit is therefore 2 The data encoded will A bar code (also barcode) is an optical Machine-readable representation of data The ZIP code is the system of Postal codes used by the United States Postal Service (USPS This uses two tall bars as "ones" and three short bars as "zeros". Here, the weights assigned to the bit positions are 7-4-2-1-0. Again, zero is encoded specially, using the 7+4 combination (binary 11000) that would naturally encode 11. This method was also used in North American telephone Multi-frequency and crossbar switching systems. In Telephony Multi-Frequency (MF is an outdated in-band signaling technique A crossbar switch (also known as cross-point switch, crosspoint switch, or matrix switch) is a Switch connecting multiple inputs to multiple [1]
The following table represents decimal digits from 0 to 9 in various two-out-of-five code systems:
| Digit | Telecommunication 01236 |
IBM 7070, 7072, 7074 01234 |
POSTNET 74210 |
|---|---|---|---|
| 0 | 01100 | 01100 | 11000 |
| 1 | 11000 | 11000 | 00011 |
| 2 | 10100 | 10100 | 00101 |
| 3 | 10010 | 10010 | 00110 |
| 4 | 01010 | 01010 | 01001 |
| 5 | 00110 | 00110 | 01010 |
| 6 | 10001 | 10001 | 01100 |
| 7 | 01001 | 01001 | 10001 |
| 8 | 00101 | 00101 | 10010 |
| 9 | 00011 | 00011 | 10100 |
| A | N/A | 1––10 | N/A |
| − | N/A | 1––01 | N/A |
| + | N/A | 0––11 | N/A |