Converting Numbers to Sign/Magnitude and Two's Complement Notation in 8 Digits

  • Thread starter notorious9000
  • Start date
  • Tags
    Notation
In summary, to find (-5) in sign/magnitude notation, you simply represent the negative number in binary and add a 1 in front to denote negativity. For two's complement, if the number is positive, simply add a 0 in front to denote positivity. If the number is negative, pad the binary representation with 0s and then invert each bit and add 1 to the least significant bit.
  • #1
notorious9000
11
0
Find (-5) to Sign / magnitude notation & Two's Complement in 8 digits
 
Last edited:
Physics news on Phys.org
  • #2
notorious9000 said:
Find (-5) to Sign / magnitude notation & Two's Complement in 8 digits

What have you tried so far? Do you know how to convert 5 into binary? That's your first step.
 
  • #3
xcvxcvvc said:
What have you tried so far? Do you know how to convert 5 into binary? That's your first step.

umm...
ex) for 4 digits
negative = 1000
positive = 0000

I guess 5 is a easy small number to make to binary

3210
-----
0101

is this right ?
so for Sign/Magnitude
1101 = -5

is this right ?

if this is right. how to convert this to Two's complement ?
 
  • #4
notorious9000 said:
umm...
ex) for 4 digits
negative = 1000
positive = 0000

I guess 5 is a easy small number to make to binary

3210
-----
0101

is this right ?
so for Sign/Magnitude
1101 = -5

is this right ?

if this is right. how to convert this to Two's complement ?
Yeah. The way I learned to take two's complement is if you have a positive number, it is simply that number with a 0 in front to denote positivity. If the number is negative, you take the positive binary representation, invert all of its binary digits, and add one. Remember, if the number is positive, if you can pad the the 2's complement with as many 0s in front as you want. Oppositely, if the number is negative, you can pad the 2's complement with as many 1s in front as you want.

Example: represent 23 and -23 in 2's complement

2's complement of 23:
step 1: find the binary representation of 23
23 base 10 = 10111 base 2
step 2: add at least one 0 in front to denote positivity. However, infinitely many is ok
answer = 010111 or 000010111, etc.

2's complement of -23:
step 1 find the binary representation of 23:
23 base 10 = 10111 base 2
step 2: pad the number with 0s (you need enough. 1 usually does it). Note, after we take the one's complement (inverting each bit), these 0s will become 1s. Remember, you can pad a negative number with infinitely many 1s.
00010111
step 3: invert each bit:
11101000
step 4: add 1 to the least significant bit:
11101001
 
  • #5


In sign/magnitude notation, (-5) would be represented as 10000101 in 8 digits. The first digit, 1, represents the sign (1 for negative) and the remaining 7 digits, 0000101, represent the magnitude (5 in binary form).

In two's complement notation, (-5) would be represented as 11111011 in 8 digits. This is achieved by first converting 5 to binary form (0101) and then taking the complement (1010) and adding 1, resulting in 1111. The first digit, 1, represents the sign (1 for negative) and the remaining 7 digits, 111011, represent the magnitude.

Both sign/magnitude and two's complement notations are commonly used in computer systems to represent negative numbers. Sign/magnitude notation is more intuitive as it directly shows the sign and magnitude of the number, while two's complement notation is more efficient for performing mathematical operations on negative numbers. It is important for scientists to be familiar with both notations in order to accurately represent and manipulate data in computer systems.
 

What is sign/magnitude notation?

Sign/magnitude notation is a way of representing a numerical value by separating the number into two parts: the sign and the magnitude. The sign indicates whether the number is positive (+) or negative (-), while the magnitude represents the absolute value of the number.

How is sign/magnitude notation different from other number notations?

Sign/magnitude notation differs from other notations, such as standard form or scientific notation, because it explicitly shows the sign of the number. This can be useful when working with both positive and negative values.

What is the purpose of using sign/magnitude notation?

The purpose of using sign/magnitude notation is to easily represent both positive and negative numbers in a clear and concise manner. It also allows for easier comparison and computation of values with different signs.

How do you convert a number from sign/magnitude notation to standard form?

To convert a number from sign/magnitude notation to standard form, simply remove the sign and write the magnitude in front of the appropriate power of 10. For example, the number +3.25 in sign/magnitude notation would become 3.25 x 10^0 in standard form.

Can sign/magnitude notation be used for non-integer numbers?

Yes, sign/magnitude notation can be used for both integer and non-integer numbers. The sign indicates the direction (positive or negative) and the magnitude represents the absolute value of the number, regardless of whether it is an integer or not.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
7
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
5
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
6
Views
9K
Replies
6
Views
286
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
8
Views
2K
Back
Top