0
\$\begingroup\$

While representing negative numbers in binary we use MSB as sign indication.In BCD we use 4 bits to represent numbers 8-15. How does a device(ex:computer) decide whether its a negative number or a number in range [8,15].

\$\endgroup\$
  • \$\begingroup\$ While representing negative numbers in binary we use MSB as sign indication -- 2's complement is much more common than sign+magnitude notation. \$\endgroup\$ – Jules Mar 16 '18 at 11:08
  • \$\begingroup\$ @Jules: But in 2's complement, the MSB is indeed the sign bit. \$\endgroup\$ – Dave Tweed Mar 16 '18 at 13:08
2
\$\begingroup\$

Neither BCD nor signed binary attempt to have a unique format that identifies them.

It is the responsibility of the processing software or hardware to ensure it understands the type and format of the data it has and to perform the correct operations on it.

In the same way, an ASCII text file is just a stream of bytes. It is only an ASCII text file if the processing software/hardware recognises it as such.

Unique identifiers for data types take up space. The BCD and signed binary formats are too low-level to use identifiers. They are normally used alone or as part of larger structures, they don't have sub-components.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.