Isn't .NET integer just based on two add-on systems?

MSDN :

Int32 values ​​are represented in 31 bits, with the thirty-second bit used as the sign bit. Positive values ​​are presented using a representation of the sign and magnitude. Negative values ​​are presented in two additional representations.

Is it not true that the representation of positive values ​​using a system of signs and quantities is identical to the representation of positive values ​​using two complement systems ?

Therefore, you should not rewrite it like this: "Int32 values ​​(regardless of positive or negative) are presented in two additional representations",

Or am I not understanding something?

+5
source share
2 answers

Yes you are right. They have to say that he uses the 2s complement system, and then gave the definition of using 31 bits, and instead of explaining the negatives as “2s complement” just explains the representation of bits for negatives. Then give them a warning about bitwise operators

+6
source

Addition 2 is just a mathematical operation, you really cannot imagine it “in” Addition 2. For more information http://reinventingthewheel.azurewebsites.net/TwosComplementTut.aspx

+1
source

All Articles