Linked Questions

-4 votes
1 answer
1k views

I'm doubt why we uses -1 as 11111111 in signed int, not 10000001. because as we learned first bit is use to specify the sign and rest of the seven bits are for the value. So in what reason designers ...
Nayana Adassuriya's user avatar
1 vote
0 answers
39 views

I recently wondered about why not just use one bit as "+/-" and use the other as a number module? Will their use not be rational or are there some other factors that prevent this from being ...
Realman's user avatar
  • 53
522 votes
24 answers
503k views

I'm in a computer systems course and have been struggling, in part, with two's complement. I want to understand it, but everything I've read hasn't brought the picture together for me. I've read the ...
94 votes
11 answers
88k views

I am trying to understand how Java stores integers internally. I know all Java primitive integers are signed, (except short?). That means one less bit available in a byte for the number. My question ...
Kevin Rave's user avatar
  • 14.5k
31 votes
3 answers
23k views

I thought the whole point of 2's complement was that operations could be implemented the same way for signed and unsigned numbers. Wikipedia even specifically lists multiply as one of the operations ...
Joseph Garvin's user avatar
18 votes
6 answers
14k views

I'm writing a tutorial to teach kids (ages 9 to 13) about programming. I started with computers themselves, they don't have that much to do with computer science, it's more about the process involved ...
dvanaria's user avatar
  • 6,783
6 votes
6 answers
13k views

This is a doubt regarding the representation of bits of signed integers. For example, when you want to represent -1, it is equivalent to 2's complement of (+1). So -1 is represented as 0xFFFFFFF. Now ...
user avatar
20 votes
2 answers
2k views

C17 6.2.6.2/4 says: If the implementation does not support negative zeros, the behavior of the &, |, ^, ~, <<, and >> operators with operands that would produce such a value is undefined....
Lundin's user avatar
  • 220k
13 votes
2 answers
3k views

I use the ~ operation for bit manipulation, and I'm just wondering how Java calculates the negative number? I checked the Java documentation: "The unary bitwise complement operator "~" inverts a ...
Freya Ren's user avatar
  • 2,164
5 votes
4 answers
3k views

I am a beginner in C . I have recently learned about 2's Complement and other ways to represent negative number and why 2's complement was the most appropriate one. What i want to ask is for example, ...
user avatar
7 votes
5 answers
4k views

Even though I read a number of articles that say that mostly 2's complement is used to represent the negative numbers in a signed integer and that that is the best method, However for some reason I ...
Kingkong Jnr's user avatar
  • 1,158
4 votes
1 answer
10k views

I understand how binary works and I can calculate binary to decimal, but I'm lost around signed numbers. I have found a calculator that does the conversion. But I'm not sure how to find the maximum ...
Nooblhu's user avatar
  • 572
1 vote
2 answers
5k views

I have 8 bit int zero = 0b00000000; and 8 bit int one = 0b00000001; according to binary arithmetic rule, 0 - 1 = 1 (borrow 1 from next significant bit). So if I have: int s = zero - one; s = -1; -...
N N's user avatar
  • 1,658
3 votes
3 answers
2k views

I'm looking for a good explanation why (not how, I know that) binary subtraction is always (?) done by adding the complement etc. Is it just because of the extra logic gates that would be necessary or ...
tmr's user avatar
  • 127
3 votes
2 answers
1k views

I have read many articles and SO answers to understand 2s complement. They have helped me a lot. However, there are few doubts in my mind about 2s complement. 1) Is 2s complement a way to store ...
Ankit's user avatar
  • 1,105

15 30 50 per page