Top "Twos-complement" questions

Two's complement is a mathematical operation on binary numbers, as well as a binary signed number representation based on this operation.

How memset initializes an array of integers by -1?

The manpage says about memset: #include <string.h> void *memset(void *s, int c, size_t n) The …

c++ c arrays twos-complement memset
What is the maximum and minimum values can be represented with 5-digit number? in 2's complement representation

What is the maximum and minimum values can be represented with 5-digit number that is assuming 2's complement representation? do …

twos-complement data-representation
Java two's complement binary to integer

I know that converting a decimal to binary with Integer.toBinaryString(355) = 0000000101100011 and Integer.toBinaryString(-355) = 1111111010011101 (where I take the lower 16 …

java binary twos-complement
2's complement hex number to decimal in java

I have a hex string that represents a 2's complement number. Is there an easy way (libraries/functions) to translate …

java hex twos-complement negative-number
Representation of negative numbers in C?

How does C represent negative integers? Is it by two's complement representation or by using the MSB (most significant bit)? …

c language-lawyer negative-number twos-complement
Why is -(-2147483648) = - 2147483648 in a 32-bit machine?

I think the question is self explanatory, I guess it probably has something to do with overflow but still I …

c 32-bit twos-complement
How do I detect overflow while multiplying two 2's complement integers?

I want to multiply two numbers, and detect if there was an overflow. What is the simplest way to do …

algorithm overflow integer-overflow twos-complement
2's complement example, why not carry?

I'm watching some great lectures from David Malan (here) that is going over binary. He talked about signed/unsigned, 1's …

binary signed twos-complement
Converting Decimal to Two's-Complement

Instructions: Convert these decimal numbers to 5-bit 2's-complement form, if possible. If not possible, explain why this is so. (16) base 10 …

binary decimal twos-complement ones-complement
Adding two Negative Numbers using 2's Complement

I was wondering if someone could double check my work for me real quick. If I'm given two negative numbers: …

binary numbers theory twos-complement complement