search
HomeCommon ProblemWhat is the value range of int32?

The value range of int32 is "-2147483648" to "2147483647"; while the value range of int64 is "-9223372036854775808" to "9223372036854775808".

What is the value range of int32?

The value range of int32

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

Positive numbers are expressed as original codes in the computer, and the highest bit is the sign bit: The original code of

1 is the original code of 0000 0000 0000 0000 0000 0000 0000 0001

2147483647 The code is 0111 1111 1111 1111 1111 1111 1111 1111

So the largest positive integer is 2147483647

Negative numbers are represented as complement codes in the computer, and the highest bit is the sign bit:

-1:

The original code is 1000 0000 0000 0000 0000 0000 0000 0001, the inverse code of

is 1111 1111 1111 1111 1111 1111 1111 1110, the complement code of

is 1111 1111 1111 1111 1111 1111 1111 1111

-2147483647: The original code of

is 1111 1111 1111 1111 1111 1111 1111 1111, the reverse code of

is 1000 0000 0000 000 0 0000 0000 0000 0000 ,

The complement is 1000 0000 0000 0000 0000 0000 0000 0001

So the smallest negative number is -2147483647? Wrong, no.

In binary, there are two table methods for 0.

The original code of 0 is 0000 0000 0000 0000 0000 0000 0000 0000, the original code of

-0 is 1000 0000 0000 0000 0000 0000 0000 0000,

because 0 is only One is needed, so use -0 as the smallest number -2147483648. The complement code of

-2147483648 is expressed as 1000 0000 0000 0000 0000 0000 0000 0000. There is no original code in 32 bits.

Note that this complement is not the real complement. The real complement is 1 1000 0000 0000 0000 0000 0000 0000 0000, which is an overflow.

So the signed 32-bit int type integer is -2147483648~2147483647

Explanation:

int range -2,147,483,648 to 2,147,483,647

int16 - Numeric range: -32768 to 32767

int32 - Numeric range: -2,147,483,648 to 2,147,483,647

int64 - Numeric range: -9223372036854775 808 to 9223372036854775808

For more programming-related knowledge, please visit: Programming Learning Course! !

The above is the detailed content of What is the value range of int32?. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools