Difference between signed and unsigned 16bit BCDs?
How do you tell the differe开发者_如何学运维nce?
For example, say you have 0110 0101 1001 0011
.
The unsigned BCD is 6593, but what is the signed value?
Usually, you tell the difference by explicitly storing the sign.
Radix complement (en.wikipedia.org/wiki/Method_of_complements)
in normal binary system, signed numbers uses the MSB (most significant bit) to determine the sign of the number, the rest of the number is the actual value.
Unlike that in Packed BCD, the 4 LSb (least significant bits) represent the sign, and the rest (to the left) of the number represents the actual value.
精彩评论