A two-out-of-five code is a
constant-weight code that provides exactly ten possible combinations of two bits, and is thus used for representing the
decimal digit
A numerical digit (often shortened to just digit) is a single symbol used alone (such as "2") or in combinations (such as "25"), to represent numbers in a positional numeral system. The name "digit" comes from the fact that the ten digits (Latin ...
s using five
bit
The bit is the most basic unit of information in computing and digital communications. The name is a portmanteau of binary digit. The bit represents a logical state with one of two possible values. These values are most commonly represented a ...
s.
Each bit is assigned a weight, such that the set bits sum to the desired value, with an exception for zero.
According to
Federal Standard 1037C
Federal Standard 1037C, titled Telecommunications: Glossary of Telecommunication Terms, is a United States Federal Standard issued by the General Services Administration pursuant to the Federal Property and Administrative Services Act of 1949, ...
:
* each decimal
digit
Digit may refer to:
Mathematics and science
* Numerical digit, as used in mathematics or computer science
** Hindu-Arabic numerals, the most common modern representation of numerical digits
* Digit (anatomy), the most distal part of a limb, such ...
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
* the usual weights assigned to the bit positions are 0-1-2-3-6. However, in this scheme,
zero
0 (zero) is a number representing an empty quantity. In place-value notation such as the Hindu–Arabic numeral system, 0 also serves as a placeholder numerical digit, which works by multiplying digits to the left of 0 by the radix, usu ...
is encoded as binary ''01100''; strictly speaking the 0-1-2-3-6 previously claimed is just a
mnemonic
A mnemonic ( ) device, or memory device, is any learning technique that aids information retention or retrieval (remembering) in the human memory for better understanding.
Mnemonics make use of elaborative encoding, retrieval cues, and image ...
device.
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