Converting Negative Numbers to Four's Complement

  • Thread starter Thread starter WaterRain
  • Start date Start date
Click For Summary

Discussion Overview

The discussion revolves around converting negative numbers to their four's complement representation, specifically focusing on the number (–3042)5 in a four-digit system. The conversation includes attempts at solutions, methods for obtaining the four's complement, and considerations regarding base conversions.

Discussion Character

  • Homework-related
  • Mathematical reasoning
  • Technical explanation

Main Points Raised

  • One participant presents a method for calculating the four's complement using the formula –X = R^n – X – 1, applying it to (–3042)5.
  • Another participant suggests obtaining the four's complement by subtracting from 4 digit by digit, recommending that the original base should be used for the calculation.
  • A participant questions whether to convert (–3042)5 to decimal or binary before proceeding with the calculation.
  • One contributor explains that treating negative numbers as positive when calculating the four's complement can yield the correct result, demonstrating this with their own calculation.
  • Another participant elaborates on the process of using four's complement to perform subtraction by adding the complement plus one, providing an example calculation in base 5.
  • Several participants reference external articles for further understanding of the complement methods, including a link to a Wikipedia page on ten's complement.

Areas of Agreement / Disagreement

Participants express varying methods for calculating the four's complement and whether to convert negative numbers to positive before applying the method. There is no consensus on a single approach, and multiple viewpoints on the process remain present.

Contextual Notes

Some participants highlight the importance of working within the original base to avoid unnecessary conversions, while others question the best approach to handle negative values in the context of four's complement. The discussion does not resolve these methodological uncertainties.

WaterRain
Messages
13
Reaction score
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
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.
 
Thanks. I'll try again :)
 
Sorry, should I convert (–3042)5 to a decimal or binary before I proceed?
 
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).
 
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.
 
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
 

Similar threads

  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
Replies
3
Views
3K
  • · Replies 6 ·
Replies
6
Views
10K
  • · Replies 24 ·
Replies
24
Views
7K