Skip to main content
edited tags
Link
CharlesB
  • 91.5k
  • 29
  • 203
  • 228
edited for clarity
Source Link
Matt J
  • 45.5k
  • 7
  • 52
  • 57

Question about two's Two's complement binary form

In a TC++ compiler, the binary representation of 5 is (00000000000000101). I know that negative numbers are stored as 2's complement, thus -5 in binary is (111111111111011). The most significant bit (sign bit) is 1 which tells that it is a negative number.

So how does the compiler know that it is -5? If If we convert it normally, like from decimal tointerpret the binary value given above (111111111111011) as an unsigned number, it gives us some other number.will turn out completely different?

AndAlso, why is the 1's compliment of 5 -6 (1111111111111010)?

Question about two's complement binary form

In a TC++ compiler, the binary representation of 5 is (00000000000000101). I know that negative numbers are stored as 2's complement, thus -5 in binary is (111111111111011). The most significant bit (sign bit) is 1 which tells that it is a negative number.

So how does the compiler know that it is -5? If we convert it normally, like from decimal to binary, it gives us some other number.

And why is 1's compliment of 5 -6 (1111111111111010)?

Two's complement binary form

In a TC++ compiler, the binary representation of 5 is (00000000000000101). I know that negative numbers are stored as 2's complement, thus -5 in binary is (111111111111011). The most significant bit (sign bit) is 1 which tells that it is a negative number.

So how does the compiler know that it is -5? If we interpret the binary value given above (111111111111011) as an unsigned number, it will turn out completely different?

Also, why is the 1's compliment of 5 -6 (1111111111111010)?

added 14 characters in body; edited title
Source Link
Michael Myers
  • 192.8k
  • 47
  • 301
  • 297

negative number representation in Question about two's complement binary form..

inIn a TC++ compiler binary, the binary representation of 5 is (00000000000000101). and iI know that negative no. isnumbers are stored as 2's compliment thuscomplement, thus -5 in binary is (111111111111011) most. The most significant bit  (sign bit) is 1 which tells that it is a negative nonumber. so

So how does the compiler knowsknow that it is -5 i mean if? If we convert it normally, like from decimal to binary, it gives us some other nonumber. and how does

And why is 1's compliment of 5 is -6 (1111111111111010)  ? thanks.....

negative number representation in binary form..

in a TC++ compiler binary representation of 5 is (00000000000000101) and i know that negative no. is stored as 2's compliment thus -5 in binary is (111111111111011) most significant bit(sign bit) is 1 which tells that it is a negative no. so how does the compiler knows that it is -5 i mean if we convert it normally like from decimal to binary it gives us some other no. and how does 1's compliment of 5 is -6 (1111111111111010)  ? thanks.....

Question about two's complement binary form

In a TC++ compiler, the binary representation of 5 is (00000000000000101). I know that negative numbers are stored as 2's complement, thus -5 in binary is (111111111111011). The most significant bit  (sign bit) is 1 which tells that it is a negative number.

So how does the compiler know that it is -5? If we convert it normally, like from decimal to binary, it gives us some other number.

And why is 1's compliment of 5 -6 (1111111111111010)?

Source Link
paragjain
  • 275
  • 1
  • 5
  • 12
Loading
lang-cpp