#In computer numerical values, there are three concepts that must be mastered: number, base number, and bit weight.
Number: Different numerical symbols that represent the size of basic numerical values in a number system. There are 10 digits in the decimal system: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9.
Base: The number of digits used in a numerical value. The base of binary is 2 and the base of decimal is 10.
Bit weight: The size of the value represented by a 1 on a certain bit in a value. For example: decimal 345, the position weight of 3 is 100, the position weight of 3 is 10, the position weight of 4 is 10, the position weight of 5 is 1
Expand according to the weight, the first weight is 10^0, the second bit is 10^1... and so on, the Nth bit is 10^(N-1), the value of this number is equal to the value of each bit * the sum of the corresponding weights of the bit.
Computers can only recognize binary numbers, but people are familiar with decimal numbers and are not used to using binary numbers. Therefore, when computers input and output data, decimal numbers are often used. The difference is that the decimal numbers here are represented by binary encoding. There are ten digits in a decimal number, and four binary digits are needed to represent a decimal number, but it is still "every tenth", so it is called a binary coded decimal number, or a binary coded decimal number, or BCD for short. (Binary coded Decimal) code.
For more related knowledge, please visit: PHP Chinese website!
The above is the detailed content of What is the number of digits in a decimal number?. For more information, please follow other related articles on the PHP Chinese website!