All About Circuits Forum > Math 1's and 2's complements of binary numbers
 Register Blogs FAQ Members List Today's Posts Search Today's Posts Mark Forums Read

 Math Discussion forum for anything math related.

#11
10-13-2011, 04:31 AM
 Papabravo Senior Member Join Date: Feb 2006 Location: Michigan, USA (GMT-5) Posts: 5,260

The end-around-carry means that you take the carry bit and add it to the result of the addition. In 4-bit words
Code:
```   0 1 1 1  -->  7
+  1 1 1 0  --> -1
-----------------------
1 0 1 0 1       6```
Select All
So here we have a 4-bit result of 0101 == 5 and a carry
Code:
```   0 1 0 1  --> Result of 5
+  0 0 0 1  --> Carry from the original addition
-------------
0 1 1 0  --> True result of 6```
Select All
That was an end-around-carry
__________________
We never have time to do it right,
But we always have time to do it over.
 The Following User Says Thank You to Papabravo For This Useful Post: PG1995 (10-18-2011)
#12
10-18-2011, 01:32 PM
 PG1995 Senior Member Join Date: Apr 2011 Posts: 737

Thank you very much, GeoRacer, MrChips, Papabravo.

I'm sorry to say this but I'm still a bit confused. But the good thing is I can understand the topic in my book. What I'm inquiring about here is for my personal learning. But as advised by GeoRacer I won't pursue the topic further after finishing this discussion. Please be patient! Thanks.

In binary system 2's complement is the maximum complement one can find. I mean to say you can't think of finding 3's complement in base 2. As I have been told 2's complement doesn't give create any problem as compared to 1's complement which has two representation for 0. I'm just curious to know if this also happens in other bases such as base 10 that using, say, 4's complement gives problems such as two representation for 0.

Quote:
 Originally Posted by Georacer Lemme take a shot at it: 0029+5532=5561. Obviously there is an overflow and thus the result must be negative. We will complement the result to find the results absolute value: |5555-5561|=|-6|=6 Bingo! (Didn't think that would work so well)
For example, in 2's complement in the binary, MSB is a sign bit. We can know by looking at the binary if it's a negative one or a positive (assuming we know that we are using complementary method). Here, in the decimal, you have overflow condition to infer the negativity of the number. Is this so?

Do we discard carry in case of decimal too if there is one?

Quote:
 Originally Posted by Georacer Lastly, your book reference wasn't at fault. It's just that it only applies to the 's complement of a number in the numbering system. Check these two examples: a)9-3 10's complement of 3 is 6 (by his method) which makes it 9+6=15 We disregard 1 as instructed by step 3 and the answer is 5. b)5-7 10's complement of 7 is 2. 5+2=7 There is no carry thus the answer is -complement(7)=-2
If I was using doing this: 9-3. I would do it as follows: 3's complement is 7 because 3+7=10 (discard the "1"), now 9+7=16. Obviously, my method doesn't work here. Where am I going wrong? Please help me.

Quote:
 Originally Posted by MrChips Here we go again. If you want to use a single digit of base 10, the numerals are 0,1,2,3,4,5,6,7,8,9. But you are mixing up unsigned with signed numbers. If you want signed numbers then the conversion is: 0 0 1 1 2 2 3 3 4 4 5 -5 6 -4 7 -3 8 -2 9 -1 Therefore the value 9 does not exist. 9 is really -1. So your result is -1, the correct answer.
So, we have two side by side sets. MrChips, I have a big confusion here. So, please don't mind my question. Suppose we want to use double digits of base 10, then I think we have numbers from 0 - 99.

Suppose I want to do (-4 x 2 = 8) using complementary method. What would be -4's complement? 96 or 6? I'm saying this because (4+96=100) and (4+6=10).
#13
10-18-2011, 01:58 PM
 MrChips Senior Member Join Date: Oct 2009 Posts: 7,141 Blog Entries: 23

If you want signed numbers, you will have to either divide your value range in half or double the number of states.
So if we want 0 to 99 in both positive and negative:

0 0
1 1
:
:
99 99
100 -100
101 -99
:
:
191 -9
192 -8
193 -7
194 -6
195 -5
196 -4
197 -3
198 -2
199 -1

So -4 x 2 is 196 x 2 = 392 = -8
__________________
Most computer problems can be attributed to a simple problem - a loosewire behind the keyboard.

#14
10-18-2011, 02:57 PM
 Georacer Super Moderator Join Date: Nov 2009 Location: Athens, Greece (GMT +2) Posts: 4,549

@PG1995

You quoted it yourself:
Quote:
 To find the complement of a n-digit long number: (base)^n - 1 - number. This is how subtraction is done using complementary method: 1. Find the complement of the subtrahend. 2. Add the complement to minuend. 3. If there is a carry of 1, add it to obtain the result; if there is no carry, re-complement the sum and attach a negative sign to obtain the result.
That said, the complement of 3 is 10-1-3=6 and 9-3->9+6->15->1+5->6

What you did wrong is the calculation of the complement. I know that 3+6 isn't equal to 10, but your source's method works, so I 'll stick to it.
As I said, I don't master the art of enumeration methods and numerical analysis.
__________________
.
I am a prisoner of high standards and low social skills
____________________________________

I wish I was the best at what I would do, and what I would do wouldn't be pretty.

 Tags binary, complements, numbers

 Related Site Pages Section Title Worksheet Digital codes Worksheet Binary math Worksheet Numeration systems Textbook Finite-state machines : Principles Of Digital Computing Textbook Binary count sequence : Sequential Circuits Counters Textbook 7-segment display : Digital Integrated Circuits Textbook Overflow : Binary Arithmetic Textbook Subtraction : Binary Arithmetic Textbook Negative binary numbers : Binary Arithmetic Textbook Octal and hexadecimal numeration : Numeration Systems

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home Electronics Forums     General Electronics Chat     The Projects Forum     Homework Help     Electronics Resources Software, Microcomputing, and Communications Forums     Programmer's Corner     Embedded Systems and Microcontrollers     Computing and Networks     Radio and Communications Circuits and Projects     The Completed Projects Collection Abstract Forums     Math     Physics     General Science All About Circuits Commmunity Forums     Off-Topic     The Flea Market     Feedback and Suggestions

All times are GMT. The time now is 08:07 AM.