About 368,000 results
Open links in new tab
  1. binary - What is “two's complement”? - Stack Overflow

    Two's complement is a clever way of storing integers so that common math problems are very simple to implement. To understand, you have to think of the numbers in binary. It basically …

  2. binary - Two's complement: why the name "two"? - Stack Overflow

    The only oddity with two's complement is that you get one more negative number in your range than you have positive numbers. But, then, other solutions give you strange things like +0 and …

  3. Why prefer two's complement over sign-and-magnitude for …

    Jul 14, 2009 · 246 I'm just curious if there's a reason why in order to represent -1 in binary, two's complement is used: flipping the bits and adding 1? -1 is represented by 11111111 (two's …

  4. binary - -128 and 128 in 2's complement - Stack Overflow

    Jun 9, 2013 · The two's complement of the minimum number in the range will not have the desired effect of negating the number. For example, the two's complement of −128 in an 8-bit …

  5. bit manipulation - Two's Complement in Python - Stack Overflow

    Mar 13, 2015 · Is there a built in function in python which will convert a binary string, for example '111111111111', to the two's complement integer -1?

  6. Adding and subtracting two's complement - Stack Overflow

    Oct 7, 2010 · Using two's complement to represent negative values has the benefit that subtraction and addition are the same. In your case, you can think of 12 - 7 as 12 + (-7). …

  7. algorithm - Understanding two's complement - Stack Overflow

    Aug 24, 2012 · I'm trying to understand two's complement: Does two's complement mean that this number is invalid: 1000 Does two's complement disallow the use of the most significant bit for …

  8. Advantage of 2's complement over 1's complement? - Stack …

    Jun 15, 2012 · 85 The primary advantage of two's complement over ones' complement is that two's complement only has one value for zero. Ones' complement has a "positive" zero and a …

  9. Two's Complement Binary in Python? - Stack Overflow

    Oct 18, 2012 · 17 To properly interpret a binary sequence as two's complement, there needs to a length associated with the sequence. When you are working low-level types that correspond …

  10. Two's complement of Hex number in Python - Stack Overflow

    Below a and b (hex), representing two's complement signed binary numbers. For example: a = 0x17c7cc6e b = 0xc158a854 Now I want to know the signed representation of a & b in …