Binary-coded decimal: Difference between revisions

Content deleted Content added
m Packed BCD: formatting fix
Packed BCD: Word size; sign
Line 360:
==Packed BCD==
<!-- Section header used in redirects -->
InSome computers whose words are multiples of an [[Octet (computing)|Octet]] (8-bit byte), for example contemporary IBM mainframe systems, support '''packed BCD''' (or '''packed decimal'''<ref name="Dewar-Smosna_1990"/>) numeric representations, in which each [[nibble]] represents either a decimal digit or a sign.<ref group="nb" name="Packed_chars"/> Packed BCD has been in use since at least the 1960s and is implemented in all IBM mainframe hardware since then. Most implementations are [[big endian]], i.e. with the more significant digit in the upper half of each byte, and with the leftmost byte (residing at the lowest memory address) containing the most significant digits of the packed decimal value. The lower nibble of the rightmost byte is usually used as the sign flag, although some unsigned representations lack a sign flag.
 
As an example, a 4-byte value consists of 8 nibbles, wherein the upper 7 nibbles store the digits of a 7-digit decimal value, and the lowest nibble indicates the sign of the decimal integer value. Standard sign values are 1100 ([[hexadecimal|hex]] C) for positive (+) and 1101 (D) for negative (−). This convention comes from the zone field for [[EBCDIC]] characters and the [[signed overpunch]] representation.