Binary-Coded Decimal (BCD) is a class of binary encodings in which each decimal digit is represented by its own binary sequence. In BCD, the binary form of a decimal number is encoded such that a 4-bit binary number represents each digit.
Each decimal digit (0-9) is represented using 4 bits, as follows:
0000 represents 0 0001 represents 1 0010 represents 2 0011 represents 3 0100 represents 4 0101 represents 5 0110 represents 6 0111 represents 7 1000 represents 8 1001 represents 9
Each decimal digit is encoded separately. For example, the decimal number 59 in BCD would be:
0101 1001
BCD encoding is often used in applications where human-readable decimal output is crucial and precision matters. Common use cases include: