English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

For example, procedure to convert 11001 = -7 in 2's comp, to offset binary format?

2007-03-05 11:30:41 · 1 answers · asked by a a 1 in Science & Mathematics Engineering

1 answers

Do three steps: (1) treat the 2’s complement as unsigned numbers, (2) add the offset you desired to them, and (3) ignore the overflow bit.

The method sounds simple but it’s not simple to explain the insight to you. Let me try.

You can view the 2’s complement numbers as offset numbers by placing a 1 in front of every non-negative number, and a 0 in front of every negative one. For example an 8-bit 2’s complement number set would look like:

Signed2’s complement with 0 or 1 to the front
-1270 1000 0000 = unsigned 128
-1260 1000 0001
-1250 1000 0010

-10 1111 1111
0 1 0000 0000
1 1 0000 0001

127 1 0111 1111

On the second column above you can see that with 1 or 0 added to the front, the 2’s complement numbers are now offset numbers (with a size of one larger bit). With that insight, you can convert a 2’s complement set to any offset sequence simply by (1) treat the 2’s complements as unsigned numbers, (2) add the offset you desired to them, and (3) ignore the overflow bit.

For example, to make the 1-byte 2’s complement numbers exemplified above to 128-offset numbers (that is to make the unsigned 128 in binary to designate 0) add unsigned 128 = 1000 000 to any binary number above then ignore any overflow bit:

The original (-127) is now 1000 000 + 1000 0000 = 1 0000 0000, drop overflow bit = 0000 0000, the beginning of the range.

The original (0) is now 1000 0000 + 0000 0000 = 1000 0000, middle of the range

And the original (127) is now 1000 0000 + 0100 0000 = 1111 1111, the last number of the range. All are as expected.

Good luck!

2007-03-06 12:20:47 · answer #1 · answered by sciquest 4 · 0 0

Offset Binary

2016-11-10 01:12:57 · answer #2 · answered by kryst 4 · 0 0

This Site Might Help You.

RE:
How to convert from 2's complement to offset binary.?
For example, procedure to convert 11001 = -7 in 2's comp, to offset binary format?

2015-08-07 05:02:39 · answer #3 · answered by Anonymous · 0 0

fedest.com, questions and answers