Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

What is the value range of int32 in computer programming?

Shulou Source: shulou.com Published: 2022-06-02 13:45:15 09月22日 Update

This article mainly introduces the value range of int32 in computer programming, which has a certain reference value. Interested friends can refer to it. I hope you will gain a lot after reading this article.

Values for int32 range from "- 2147483648" to "2147483647", while values for int64 range from "- 9223372036854775808" to "9223372036854775808".

Value range of int32

The range of 32-bit int type variables in the computer, where the int type is a signed integer.

The positive number is represented as the original code in the computer, and the highest bit is the symbol bit:

The original code of 1 is 0000 0000 0000 0001

The original code of 2147483647 is 0111 1111 1111 1111

So the largest positive integer is 2147483647.

A negative number is represented as a complement in a computer, and the highest bit is a symbol bit:

-1:

The original code is 1000 0000 0000 0000 0001

The inverse code is 1111 1111 1111 1110

The complement is 1111 1111 1111

-2147483647:

The original code is 1111 1111 1111

The inverse code is 1000 0000 0000 0000

The complement is 1000 0000 0000 0000 0001

So the smallest negative number is-2147483647? No, it's not.

In binary, 0 has two table methods.

The original code of + 0 is 0000 0000 0000

The original code of-0 is 1000 0000 0000 0000

Since only one zero is needed, take-0 as the smallest number-2147483648.

The complement of-2147483648 is expressed as 1000 0000 0000 0000 0000000, and there is no original code in 32 bits.

Note that this complement is not a real complement, the real complement is 1 1000 0000 0000 0000, overflow.

So the signed 32-bit int type integer is-214748364802147483647

Description:

Int range-2147483648 to 2147483647

Int16- values range from-32768 to 32767

Int32- values range from-2147483648 to 2147483647

Int64- values range from-9223372036854775808 to 9223372036854775808

Thank you for reading this article carefully. I hope the article "what is the value range of int32 in computer programming" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Tags: Range complement computer numerical value symbol article integer type programming minimum maximum middle table inverse code negative number maximum binary value interest variable and at the same time Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia vpn macOS Huawei Xiaomi