开发者

Difference between signed and unsigned 16bit BCDs?

开发者 https://www.devze.com 2023-01-24 05:59 出处:网络
How do you tell the differe开发者_如何学运维nce? For example, say you have 0110 0101 1001 0011.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号