r/programminghomework • u/Blindbyakko • Nov 20 '17
Binary question(maybe misc others)
So i'm trying to study for my exam, using a previous assignment i did, but i can't figure out why i got the question incorrect.
Question - What does the number 1000000_2 represent in decimal? (two's compliment)
I thought i would just compliment the bits( going from 10000000 ->> 11111111_2 then add 1. Which would give me [1]00000000. So in decimal i would have 0(tossing the overflow bit) Where did i go wrong?
1
Upvotes
View all comments
Show parent comment
1
u/Blindbyakko Nov 20 '17
Ok, So if i do this correctly. i should have gotten -1?
1000 0000 ->>> 1000 000(after flipping and adding 1)
1111 1111 - >>> 0000 0001(After flipping and adding 1)
Which should be 1000 0001 which is -1 in decimal.