In a computer, fixed points are divided into signed numbers and unsigned numbers. Among them, there are three representations of signed number: original code, complement and complement. Inverse code means that the inverse code of a specified positive number is the same as its original code; The negation of a negative number is the bitwise negation of its original code, except the sign bit.
The word length of a computer is n bits, the highest bit of an n-bit binary number is a sign bit, and the rest of the n- 1 bits are numerical bits. When using complement notation, the range of representable number x is -2 power ≤X≤2 power-1.
Extended data:
Size and range of storage space for common data types:
1 and Byte (byte type) are represented by 1 byte, and the numerical range is 0-255.
2.Boolean (Boolean/Logic) is represented by 2 bytes, and the numerical range is true or false.
3.Integer (integer type) is represented by 2 bytes, and the numerical range is-32,768 ~ 32,767.
4.Long (long integer) is represented by 4 bytes, and its numerical range is -2,147,483,648 ~ 2,147,483,647.
5.Single (single-precision floating-point type) is represented by 4 bytes, and the range of values is:
Negative range:-3.402823E38 ~-1.405438+0298e-45.
Positive number range:1.401298e-45 ~ 3.423e38.
6.Double (double-precision floating-point type) is represented by 8 bytes, and the range of values is:
Negative range:-1.797,693,134,862,32e308 ~-4.940,656,458,412,47e-324.
Positive number range: 4.940,656,458,412,47e-324 ~1.797,693,134,862,32e308.
Baidu Encyclopedia-Signing Number Processing
Baidu Encyclopedia-Data Type