Content-Type: text/html Wikipedia: Binary Coded Decimal

[Home]Binary Coded Decimal

HomePage | RecentChanges | Preferences
You can edit this page right now! It's a free, community project

Binary coded decimal (BCD) is a way of encoding numbers in computer memory. In BCD, numbers are represented as decimal digits, and each digit is represented by four bits:
 Digit Bits      Digit Bits
0 0000 5 0101 1 0001 6 0110 2 0010 7 0111 3 0011 8 1000 4 0100 9 1001
To encode a number such as 127, then, one simply encodes each of the decimal digits as above, giving (0001, 0010, 0111).

Since most computers store data in eight-bit bytes, there are two common ways of storing four-bit BCD digits in those bytes: either one can simply ignore the extra four bits of each byte, usually filling them with zero bits or one bits (as in EBCDIC?); or one can store two digits per byte, called "packed" BCD. Thus the number 127 would be represented as (11110001, 11110010, 11110111) in EBCDIC; or as (00000001, 00100111) in packed BCD (with a leading zero added).


HomePage | RecentChanges | Preferences
You can edit this page right now! It's a free, community project
Edit text of this page | View other revisions
Last edited June 5, 2001 5:10 pm (diff)
Search: