Why is Int32's maximum value 0x7FFFFFFF?

前端 未结 6 705
野趣味
野趣味 2021-02-02 10:38

I saw in MSDN documents that the maximum value of Int32 is 2,147,483,647, hexadecimal 0x7FFFFFFF.

I think, if it\'s Int32 it should store 32-bi

6条回答
  •  感情败类
    2021-02-02 11:25

    It's because it's a signed integer. An unsigned 32-bit integer give you the value you expect.

    Check out this MSDN page - http://msdn.microsoft.com/en-us/library/exx3b86w(v=vs.80).aspx

    For a more in depth explanation on why this is check out the link in Jackson Popes answer related to Two's Complement number representation.

    Also some further reading.

提交回复
热议问题