0

I am researching how to convert a decimal number to a sign a magnitude number,

I understand that the number 19 in binary equates to 10011 as a binary string, however now i am stuck on converting this to a sign and magnitude number.

From my understanding i would say that 10011 would equal -3 in sign and magnitude because of the sign 'most significant' digit in the binary string being a 1 meaning that it must be negative, and left over is the 0011 which converting it back to decimal is 3... so am i right that 19 in decimal is -3 is sign and magnitude ? or have i got something wrong ? i can't find any place only which fully explains how this process works.

Thankyou for any help.

Bradley Cousins
  • 187
  • 6
  • 17

1 Answers1

1

I get the feeling that I am doing your homework but you don't understand so I will try to explain.

The decimal number is 19. You convert that to binary and it is 10011. But what if you want to convert -19? You can't represent that currently because there is no "-" in binary. So you decide to put an extra bit in the front of your binary number to represent whether it is a positive or negative. The most significant digit is 1 so you say that a 1 is going to represent a negative and a 0 is going to represent a positive. So this time when you convert 19 you get 010011. The first digit is a 0 so you know that it is positive. The first digit is the sign. When you convert -19 you get 110011. The first digit is a 1 so you know that it is a negative. The first digit is the sign. The rest of the number indicates the magnitude. In both of those two sums the magnitude is 19 but the sign is different.

If you convert decimal (19) to binary (10011) to decimal again you need to get back to the original answer and 19 is not -3.

Hope this helps.

Watch this https://www.youtube.com/watch?v=ikThX9Z0jUo

abiNerd
  • 1,976
  • 1
  • 18
  • 22