Conversion from the Decimal system to the Signed-Magnitude system


The conversion of a decimal number to the Signed-Magnitude system is very similar to the conversion to the NBC. The only difference between the two processes is the fact that not only the natural numbers can be converted, but also negative numbers have their representation. This is due to the previously mentioned sign bit, which determines, whether the number is positive or negative.
Example 1:
48
48 | 2 0
24 | 2 0
12 | 2 0
6 | 2 0
3 | 2 1
1 | 2 1

48 = 110000 in NBC
48 = 00110000 in S-M
The final result stored on 8-bits is equal to 00110000

Example 2 :
-48
48 | 2 0
24 | 2 0
12 | 2 0
6 | 2 0
3 | 2 1
1 | 2 1

48 = 110000 in NBC
-48 = 10110000 in S-M
The final result stored on 8-bits is equal to 10110000