# Two's complement

#### thexy

Joined Dec 13, 2015
130
If we have 6 Bit (2-komplement) and we need to find biggest and smallest number and wrote them in binar and dezcimal form. How to do it?

6 bit (Two's Complement) decimal -32, binary 111111 - that's for the biggest number
-33, binary 100001 - that's for the smallest number

Is this correct? If not can someone find my mistake.

#### WBahn

Joined Mar 31, 2012
29,519
Describe what you know about 2's complement.

If I give you the bit pattern 010101, how can you find the decimal value?

If I give you the bit pattern 101010, how can you find the decimal value?

#### thexy

Joined Dec 13, 2015
130
0 1 0 1 0 1 that's 16+4+1=21
32 16 8 4 2 1

1 0 1 0 1 0 that's 32+8+2=42
32 16 8 4 2 1

Describe what you know about 2's complement. Hm nothing.

#### Papabravo

Joined Feb 24, 2006
20,615
The first example in your previous post is correct, 010101 is equal to 21. The second example is correct only if you agree that all six bit numbers are unsigned positive numbers.
2's complement representation is a way to represent both positive an negative numbers. A couple of things you need to know.
1. negative numbers are all less than 0
2. 0 is less than all positive numbers
Would you believe me if I tell you that 101010 actually represents a negative number in 2's complement notation?
Would it help you if I told you that 111111 actually represents -1 in 2's complement notation.

#### thexy

Joined Dec 13, 2015
130
The first example in your previous post is correct, 010101 is equal to 21. The second example is correct only if you agree that all six bit numbers are unsigned positive numbers.
2's complement representation is a way to represent both positive an negative numbers. A couple of things you need to know.
1. negative numbers are all less than 0
2. 0 is less than all positive numbers
Would you believe me if I tell you that 101010 actually represents a negative number in 2's complement notation?
In this case I was counting unsigned ones hah

#### thexy

Joined Dec 13, 2015
130
Come on. Can someone answer on my question only without asking any other.Thank you.

#### Papabravo

Joined Feb 24, 2006
20,615
Explain to me why we should do that.

#### WBahn

Joined Mar 31, 2012
29,519
0 1 0 1 0 1 that's 16+4+1=21
32 16 8 4 2 1

1 0 1 0 1 0 that's 32+8+2=42
32 16 8 4 2 1

Describe what you know about 2's complement. Hm nothing.
If you know nothing about 2's complement, then might it not be a reasonable thing to spend some time learning about two's complement before attempting to answer questions about two's complement?

Just a thought.

#### WBahn

Joined Mar 31, 2012
29,519
Come on. Can someone answer on my question only without asking any other.Thank you.
Why are you bothering to take these classes? You don't seem to want to actually learn anything. Assuming you manage to graduate, are you planning to just go through your career asking your coworkers to do your work for you?

#### thexy

Joined Dec 13, 2015
130
Why are you bothering to take these classes? You don't seem to want to actually learn anything. Assuming you manage to graduate, are you planning to just go through your career asking your coworkers to do your work for you?
Of course not. I have watched videos, I know about that two complements, I'm not going to copy just random text from google and show you what I know. Currently I'm dealing with some problems in school because I came in another country where isn't spoken my mother language.

If you can't help me, than don't, I don't want to read stuff how only I want to graduate, if it is like that I wouldn't be here, there is much more easier ways to get results...
Thank you.

#### WBahn

Joined Mar 31, 2012
29,519
Of course not. I have watched videos, I know about that two complements, I'm not going to copy just random text from google and show you what I know. Currently I'm dealing with some problems in school because I came in another country where isn't spoken my mother language.

If you can't help me, than don't, I don't want to read stuff how only I want to graduate, if it is like that I wouldn't be here, there is much more easier ways to get results...
Thank you.
First you say that you know nothing about two's complement, and now you say that you do. But you actually reveal the depth of your efforts by saying that copying random text from Google would show what you "know". If that's what you would have to do to show your level of understanding of a subject, then what becomes obvious is that you know little to nothing about it -- and that you aren't interested in learning anything more than that.

#### hp1729

Joined Nov 23, 2015
2,304
Come on. Can someone answer on my question only without asking any other.Thank you.
So then is 011111 the largest positive number? 000000 is 0. 111111 is -1. 100000 is the highest negative number?

what is the difference if he reads it in a book or reads it from here?

#### thexy

Joined Dec 13, 2015
130
First you say that you know nothing about two's complement, and now you say that you do. But you actually reveal the depth of your efforts by saying that copying random text from Google would show what you "know". If that's what you would have to do to show your level of understanding of a subject, then what becomes obvious is that you know little to nothing about it -- and that you aren't interested in learning anything more than that.
I don't have time to type you what I know about two complement numbers, btw. I'm not studying on english, so even if I had time I wouldn't be able because my dicitonary isn't that big.

Greetings

#### WBahn

Joined Mar 31, 2012
29,519
So then is 011111 the largest positive number? 000000 is 0. 111111 is -1. 100000 is the highest negative number?

what is the difference if he reads it in a book or reads it from here?
Actually, there is a fair bit of difference. If he makes the effort to look up the information, then he is actually making an effort to discover information. All he seems to want is for someone to spoon feed everything to him just by asking. What he should be doing is learning as much as he can on his own and then coming here with specific questions where he is confused about a concept.

#### WBahn

Joined Mar 31, 2012
29,519
I don't have time to type you what I know about two complement numbers, btw. I'm not studying on english, so even if I had time I wouldn't be able because my dicitonary isn't that big.

Greetings
Then it becomes very difficult to guide you because we have no idea where you are coming from.

So let's try a different route and see if you know some specific things about two's comp that are relevant to this discussion.

Given a bit pattern that is in two's comp, how can you tell if the value it represents is positive or negative?

#### Rissy

Joined Nov 23, 2015
106
If we have 6 Bit (2-komplement) and we need to find biggest and smallest number and wrote them in binar and dezcimal form. How to do it?

6 bit (Two's Complement) decimal -32, binary 111111 - that's for the biggest number
-33, binary 100001 - that's for the smallest number

Is this correct? If not can someone find my mistake.
-32 in two's complement = 100000 This is because we are counting from the largest occurrence of a binary 1, from below zero.
So 1,0,0,0,0,0 = -32 + 0 + 0 + 0 + 0 + 0

The first "1" in the sequence represents a negative notation, as well as the value from which to consider all the other binary components of the binary number given.

i.e.

100001 in two's complement = -32,0,0,0,0,1 = -32 + 0 + 0 + 0 + 0 + 1 = -31

To give another persons example: 101010
In two's complement, this can be read like: -32,0,8,0,2,0 OR -32 + 0 + 8 + 0 + 2 + 0 = -22

I'm not an expert in all this of course, but this is a gist for a beginner's point of view. I hope this helps.

#### thexy

Joined Dec 13, 2015
130
-32 in two's complement = 100000 This is because we are counting from the largest occurrence of a binary 1, from below zero.
So 1,0,0,0,0,0 = -32 + 0 + 0 + 0 + 0 + 0

The first "1" in the sequence represents a negative notation, as well as the value from which to consider all the other binary components of the binary number given.

i.e.

100001 in two's complement = -32,0,0,0,0,1 = -32 + 0 + 0 + 0 + 0 + 1 = -31

To give another persons example: 101010
In two's complement, this can be read like: -32,0,8,0,2,0 OR -32 + 0 + 8 + 0 + 2 + 0 = -22

I'm not an expert in all this of course, but this is a gist for a beginner's point of view. I hope this helps.

33 is 100001, so - 33 will be 011110 + 1 or how?

#### Rissy

Joined Nov 23, 2015
106
-33 in two's complement would need another binary number.

1011111 = -64 + 0 + 16 + 8 + 4 + 2 + 1 = -33

#### WBahn

Joined Mar 31, 2012
29,519
33 is 100001, so - 33 will be 011110 + 1 or how?
If you have a 6-bit number and you know that it is in two's complement, the if the first bit is a 1, what do you know about the number it represents?

Find this out and then ask whether the pattern 100001 can represent the value 33.