Converting Negative Numbers to Four's Complement

  • Thread starter WaterRain
  • Start date
In summary, the complement of a number is found by converting the negative number to the four's complement and adding one.
  • #1
WaterRain
13
0

Homework Statement


Represent (–3042)5 in the 4-digit 4’s complement system.

Homework Equations


–X = R^n – X – 1

The Attempt at a Solution


5^4 – 3042 – 1 = 625 – 3042 – 1 = ?

Answer should be (1402)4s
 
Physics news on Phys.org
  • #2
You can obtain the 4's complement of a four-digit number by subtracting from 4, digit by digit. Give it a try.
For better understand how to do it and why we need to do this, you can look up different articles, such as
http://en.wikipedia.org/wiki/Ten's_complement
which explains the nine's complement in detail.
 
  • #3
Thanks. I'll try again :)
 
  • #4
Sorry, should I convert (–3042)5 to a decimal or binary before I proceed?
 
  • #5
For the complement, you are better off doing it in the original base.
For example, the nines complement of 1423 is 8576. You'd be doing unnessary extra work if you do the conversion, say from base 6 to base 10, and then reverting it to base 6.
Another example:
5's complement of 1452 (base 6) would be 4103, namely take each digit from 5 and write down the new number.
5-1=4, 5-4=1, 5-5=0, 5-2=3 to give 4103 (base 6).
 
  • #6
How about dealing with negatives? Just treat them as positive?

In my case, 4's complement of (–3042)5
4-3=1, 4-0=4, 4-4=0, 4-2=2 giving (1402)4s
I'll get the answer with the method ignoring the negative.
 
  • #7
This is the idea, by converting the negative value to the four's complement, you end up with a positive number that you can ADD instead of subtract.
This way, we can subtract by adding the 4's complement PLUS ONE, and ignore any carry past the maximum number of digits.
For example, to subtract 2421 (base 5) from 4213 (base 5), we proceed as follows (all calculations use base 5):
4213-2421
=4213+(4's complement of 2421) + 1
=4213+2023+1
=(1)1241+1 [ ignore the carry of 1]
=1242
If you proceed to do the calculations using base 5, or by conversion to base 10, and reconvert to base 5, you would get the same result.

I suggest you read and understand the following article which explains the method in detail:
http://en.wikipedia.org/wiki/Ten's_complement
 

FAQ: Converting Negative Numbers to Four's Complement

1. What is complement?

Complement refers to a group of proteins that are part of the immune system and help defend the body against foreign invaders, such as bacteria and viruses.

2. How does the complement system work?

The complement system works by recognizing and binding to foreign substances, marking them for destruction by immune cells or directly attacking and destroying them. It also helps to stimulate inflammation and attract other immune cells to the site of infection.

3. What happens when the complement system is not functioning properly?

If the complement system is not functioning properly, it can result in an increased risk of infections, as the body may not be able to effectively fight off foreign invaders. It can also lead to autoimmune disorders, where the immune system attacks healthy cells and tissues in the body.

4. What are some disorders associated with complement deficiencies?

Some disorders associated with complement deficiencies include hereditary angioedema, which causes swelling in various parts of the body, and complement-mediated glomerulonephritis, which is a type of kidney disease.

5. How can complement deficiencies be treated?

Complement deficiencies can be treated with replacement therapy, where the missing complement proteins are infused into the body. In some cases, medications may also be used to help control symptoms and prevent complications.

Similar threads

Replies
5
Views
1K
Replies
10
Views
2K
Replies
8
Views
2K
Replies
2
Views
2K
Replies
6
Views
9K
Replies
24
Views
6K
Back
Top