+ 6

Binary to one’s and two’s complement

https://drive.google.com/file/d/1t_GE4CQxCcV9XHpYV9XJB3NWAzx3jU_q/view?usp=drivesdk In the question it is said to convert binary numbers to ones and twos complement. But i dont know how to show, how i have found them. Please, help me to show steps of converting them, if i have done wrong. I couldnt understand from youtube and google) Thanks!

18th Feb 2022, 6:01 PM
Laziza IOS
Laziza IOS - avatar
18 Antworten
+ 4
One's complement form is : just invert all bits, from 0 to 1 and 1 to 0. Then you get 1st complement. For 2's complement, Calculate one's complement and add 1 bit to it. You get 2 's complement. 5 binary form is 0000 0101 1st complement is ~5 flip all bits : 1111 1010 2s complement is 1111 1010 1 __________ 1111 1011 ----------------- hope it helps.
18th Feb 2022, 6:21 PM
Jayakrishna 🇮🇳
+ 2
Aa sorry, well you can write that for 1's complement that ones become zero and zeros become ones, And for 2s complement just add 1 to the 1's complement And for signed that the first bit is the sign Or just leave it like that looks okay
18th Feb 2022, 6:14 PM
Мартин 😑🎵
Мартин 😑🎵 - avatar
+ 2
Your 2's complement last nibble is 0110 Your arithmetic is wrong 0101 + 1 = 0110
19th Feb 2022, 11:26 AM
Мартин 😑🎵
Мартин 😑🎵 - avatar
+ 1
Your ones complement is good For 2's complement just add Ones complement + 1
18th Feb 2022, 6:09 PM
Мартин 😑🎵
Мартин 😑🎵 - avatar
+ 1
Мартин 😑🎵 yes i am knowing what the answer will be. But my teacher asking for steps. How can i show steps for converting to ones and twos complement. Or just writing answer is enough for them?
18th Feb 2022, 6:10 PM
Laziza IOS
Laziza IOS - avatar
+ 1
Kruti 0101 in ones complement will be 0111 in twos yes?
19th Feb 2022, 10:41 AM
Laziza IOS
Laziza IOS - avatar
+ 1
Laziza Khasanova what is 2' complement first In the computer 0101 = 5 so positive integers are represented like this But what about -5 So -5 = 2's complement of 5 That is -5 = 1010 + 1 = 1011
19th Feb 2022, 11:07 AM
Мартин 😑🎵
Мартин 😑🎵 - avatar
+ 1
Ok so now how to evaluate (5 - 7) 5 - 7 = 5 + (-7) 5 = 0101 -7 = 1's complement(0111) + 1 = 1000 + 1 = 1001 Now 0101 + 1001 = 1110 And if you find 2'complement from result 0001 + 1 = 2 Which is 5 - 7 = -2 So 2's complement is used to transform subtraction into addition
19th Feb 2022, 11:17 AM
Мартин 😑🎵
Мартин 😑🎵 - avatar
+ 1
Last if you try -5 + 7 Is 1011 + 0111 = 10010 Because we are using 4 bits here it is overflowing so we cut the 1 And becomes 0010 = 2
19th Feb 2022, 11:22 AM
Мартин 😑🎵
Мартин 😑🎵 - avatar
+ 1
Мартин 😑🎵 I have binary 01111101111101111010 Ones will be 1000 0010 0000 1000 0101 Twos will be 1000 0010 0000 1000 1110 Correct?
19th Feb 2022, 11:22 AM
Laziza IOS
Laziza IOS - avatar
+ 1
Laziza Khasanova If your number is 1010, 1's complement will be 0101. 2's complement will be 0110.
19th Feb 2022, 3:17 PM
Kruti
Kruti - avatar
0
Jayakrishna🇮🇳 2s compliment of 0111 0101 0101 0101 will be 1000 1010 1010 1010 1 1000 1010 1010 1011 Like that?
19th Feb 2022, 8:15 AM
Laziza IOS
Laziza IOS - avatar
0
Laziza Khasanova yes 1000 1010 1010 1011 is correct.
19th Feb 2022, 8:50 AM
Kruti
Kruti - avatar
0
Welcome
20th Feb 2022, 4:12 PM
Salman Ahead Salman Alahdl
Salman Ahead Salman Alahdl - avatar
0
Laziza Khasanova Ones is correct Twos is wrong Say you have 8 bits for numbers 1 bit used to indicate negative or 0 With twos complement this is - 2^(n-1) in this case -2^7 = -128 Now lets make -92 STEP 1: positive 92 0:101 1100 STEP 2: flip 1:010 0011 (If we were to count now it would be -128 + 32 + 2 + 1 = -93 *off by 1 ) STEP 3: add 1 1:010 0011 +0:000 0001 ———————- = 1:010 0100 Now count -128 + 32 + 4 = -92 —————————————— So looking just at your right most 4 bits You start with : 0101 Adding 1 : + 0001 ——————— = 0110 Not 1110 Furthermore you start with 515962 so you should get -515962 But you actually have (-2^19) + 2^13 + 2^7 + 2^3+2^2 + 2^1 = -515954
20th Feb 2022, 5:28 PM
Raul Ramirez
Raul Ramirez - avatar
0
@Laziza Khasanova Late responding 😔: (due to off from SL) may it already clear.. . 2s compliment of 0111 0101 0101 0101 will be 1000 1010 1010 1010 1 1000 1010 1010 1011 Yes. 2) 0111 1101 1111 0111 1010 One-s will be 1000 0010 0000 1000 0101 Two-s will be 1000 0010 0000 1000 0110
26th Feb 2022, 6:42 PM
Jayakrishna 🇮🇳
- 1
Hi
19th Feb 2022, 12:31 PM
احمد یوسفی
احمد یوسفی - avatar
- 1
Hello to all friends
19th Feb 2022, 12:32 PM
احمد یوسفی
احمد یوسفی - avatar