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

I really don't understand this. I am tasked to represent the decimal values of -37, -54, and 56 in binary using signed-and-magnitude representation. Can anyone help?

2007-07-29 13:54:13 · 3 answers · asked by mongo22 2 in Computers & Internet Programming & Design

3 answers

Use the calculator in windows to do this. Enter in your number as a decimal then hit the binary radio button and you will see this in binary. (Change the other option to BYTE)

Also you will need to view the calculator using the scientific view:

VIEW>SCIENTIFIC

2007-07-29 15:12:42 · answer #1 · answered by Ed the Engineer 3 · 0 0

Method 1:
Divide the number repeatedly by 2 (Answer being a whole number and a remainder, The same as Modula-2 Div and Mod commands)
The First remainder is the LSB (Least Significant Bit or Digit, the digit on the right of the number) of the Binary number. The next remainder is the next digit, and so on until the value is 0.
For Example: Convert 145 into base 2.


145÷2=
72
Rem 1
72÷2=
36
Rem 0
36÷2=
18
Rem 0
18÷2=
9
Rem 0
9÷2=
4
Rem 1
4÷2=
2
Rem 0
2÷2=
1
Rem 0
1÷2=
0
Rem 1
So 145 = %10010001
Method 2:

Subtract the largest power of two (which is less than the number) from the number. Then carry on as in the following example:
Convert 145 into base 2.


145 - 2^7 (i.e. 128)
=17
So Bit 7 = 1
17 - 2^6 (i.e. 64)
Doesn't Go
So Bit 6 = 0
17 - 2^5 (i.e. 32)
Doesn't Go
So Bit 5 = 0
17 - 2^4 (i.e. 16)
=1
So Bit 4 = 1
1 - 2^3 (i.e. 8)
Doesn't Go
So Bit 3 = 0
1 - 2^2 (i.e. 4)
Doesn't Go
So Bit 2 = 0
1 - 2^1 (i.e. 2)
Doesn't Go
So Bit 1 = 0
1 - 2^0 (i.e. 1)
=0
So Bit 0 = 1
So 145 = %10010001

Binary Addition
One Bit Binary Addition
Both elements to be added and the answer can only be one bit long!
So:
0 + 0 = 0
0 + 1 = 1
1 + 0 = 1
1 + 1 = 0 and Carry
The carry occurs because the answer is bigger than the maximum allowed for that digit. A similar thing happens in Decimal. If we add on paper 7 and 5 Our answer is 12, but we have to write down 2 and Carry 1. We then put that carry into the sum for the next digit. So For Example:
64 + 128
Units: 4 + 8 = 2 + Carry
Tens: 6 + 2 + Carry (from Units) = 9
Hundreds: 0 + 1 = 1
Answer: 192

It is exactly the same for binary addition:

General Binary Addition

%1110 + %0011
Ones: 0 + 1 = 1
Twos: 1 + 1 = 0 + Carry
Fours: 1 + 0 + Carry (from Twos) = 0 + Carry
Eights: 1 + 0 + Carry (from Fours) = 0 + Carry
Sixteens: 0 + 0 + Carry (from Eights) = 1
Answer: %10001

Similarly Binary Multiplication, Division and Subtraction are performed in the same manner as their Decimal Counterparts.

Negative Numbers In Binary
Negative numbers in Binary are almost always displayed in "2's Complement" form.
For a negative number, invert all the bits of it's positive counterpart and add one. For Instance, in 16-bit decimal numbers:
1 = %0000 0000 0000 0001
Inverting the bits gives: %1111 1111 1111 1110
Adding 1 gives: %1111 1111 1111 1111 = -1
Because (a) - (b) = (a) + (-b) , and since it is so easy to find the negative of a number. ALU's perform subtraction as adding a negative.

2007-07-29 16:01:10 · answer #2 · answered by Anonymous · 0 0

can you give the actually work to answer this question instead of using a calculator?

2016-05-17 07:56:17 · answer #3 · answered by monica 3 · 0 0

fedest.com, questions and answers