Pergunta

How do you tell the difference? For example, say you have 0110 0101 1001 0011. The unsigned BCD is 6593, but what is the signed value?

Foi útil?

Solução

Usually, you tell the difference by explicitly storing the sign.

Radix complement (en.wikipedia.org/wiki/Method_of_complements)

Outras dicas

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top