The three representation methods of computer machine numbers are original code, complement code and complement code. When the " " sign in the true value form of a number is represented by "0" and the "-" sign is represented by "1", it is called the original code form of the number. In order to overcome the shortcomings of the original code operation, the machine number's complement and complement representation are used; for positive numbers, the complement code has the same form as the original code, and for negative numbers, the complement code is the numerical part of the original code. opposite. The complement code is introduced based on the concept of congruence. In computer systems, values are always represented and stored in the complement code.
The operating environment of this tutorial: Windows 7 system, Dell G3 computer.
The three representation methods of computer machine numbers are original code, inverse code and complement code.
Introduction to machine numbers
Machine numbers are numbers that "digitize" symbols and are the binary representation of numbers in the computer . Machine numbers have two characteristics: one is the digitization of symbols, and the other is that the size of the number is limited by the machine word length.
Machine numbers have two basic characteristics:
1. Symbol digitization of numbers. Practical data includes positive numbers and negative numbers. Since the hardware inside the computer can only represent two physical states (represented by 0 and 1), the positive sign " " or negative sign "-" of the practical data is used in the machine. Bit binary 0 or 1 to distinguish. Usually this symbol is placed in the highest bit of the binary number, which is called the sign bit. 0 represents the symbol " ", and 1 represents the symbol "-". Because the sign occupies one bit, the formal value of the number is not equal to the real value. The value corresponding to the machine number with the sign bit is called the true value of the machine number. For example, the binary truth number -011011 has a machine number of 1011011.
2. The number of binary digits is limited by the machine equipment. The number of binary digits that the machine's internal equipment can represent at one time is called the machine's word length. The word length of a machine is fixed. A word length of 8 bits is called a byte. Machine word lengths are generally integer multiples of bytes, such as word lengths of 8 bits, 16 bits, 32 bits, and 64 bits.
Form of machine number
1. Original code
Use "0" to represent the " " sign in the true value form of the number, and "- "When the number is represented by "1", it is called the original code form of the number, or the original code for short. If the word length is n bits, the original code can generally be expressed as:
When X is a positive number, [X] is the same as X, that is, [X] is = X. When X is negative. Since X itself is a negative number, in fact, the sign bit before the absolute value of the numerical part of |
The original code representation is relatively intuitive. Its numerical part is the absolute value of the number, and the conversion with true value and decimal number is very convenient. But its addition and subtraction operations are more complicated. When adding two numbers, the machine must first determine whether the signs of the two numbers are the same. If they are the same, the two numbers are added. If the signs are different, the two numbers are subtracted. Before doing subtraction, you need to judge the absolute value of the two numbers, then subtract the decimal from the large number, and finally determine the sign of the difference. In other words, when adding in such a direct form, the sign bit of the negative number cannot be the same as the sign of the difference. The numerical part participates in the operation together, but a separate line must be used to determine the sign bit of the sum. To realize these operations, the circuit is very complicated, which is obviously not economical and practical. In order to reduce equipment and solve the problem of the sign bit of negative numbers participating in operations in the machine, subtraction operations are always changed into addition operations, and two machine numbers, one's complement and one's complement, are introduced.
2. Inverse code
As mentioned above, in order to overcome the shortcomings of the original code operation, the inverse code and complement representation of machine numbers are used. That is, for positive numbers, the complement code has the same form as the original code; for negative numbers, the complement code is the inversion of the numerical part of the original code.
3. Complement code
Complement code is introduced based on the concept of congruence. Let’s look at an example where subtraction is implemented by addition. Assume that the current time is 6 o'clock Beijing time, but there is a watch that is 8 o'clock, which is 2 hours ahead of Beijing time. There are two calibration methods, one is to set back 2 hours, and the other is to set 10 hours forward. If it is stipulated that the reverse dial is for subtraction and the forward dial is for addition, then subtracting 2 and adding 10 are equivalent to the watch, that is to say, subtracting 2 can be achieved by adding 10. This is because 8 plus 10 equals 18. However, the watch can only indicate a maximum of 12. When it is greater than 12, 12 is naturally lost. 18 minus 12 leaves only 6. This shows that subtraction can be replaced by addition under certain conditions. Here "12" is called "modulo", and 10 is called the complement of "-2" modulo 12. Generalized to general:
A – B = A ( – B M ) = A ( – B ) complement
It can be seen that under the condition of modulus M, A minus B can be Use A plus -B's complement to achieve this. Here the module can be regarded as the capacity of the counter. For the above example of the watch, the module is 12. In the computer, its components have a fixed number of digits. If the number of digits is n, the count value is, that is, the counter capacity is. Therefore, the complement code in the computer is modulo " ", and its definition is as follows:
In short, for a positive number, its complement has the same form as the original code; and from equations (3) and (4), it can be seen that for a negative number, the complement is the last digit of its complement plus 1.
In short, the original code, complement code and complement code of positive numbers are exactly the same; the original code, complement code and complement code of negative numbers have different forms. In addition, special attention should be paid to the fact that for the one's complement and one's complement of a negative number (that is, a number with a sign bit of 1), the several digits after the sign bit do not represent the value of the number. If you want to know the size of this number, you must require its complement or complement.
Recommended: "Programming Video"
The above is the detailed content of What are the three ways to express the number of computer machines?. For more information, please follow other related articles on the PHP Chinese website!

把逻辑地址转换为内存物理地址的过程称作“重定位”。程序发出的逻辑地址并不是数据或指令的真实存放地,但可以对这个地址进行转换来获得真实存放地的物理地址,相当于重新定位一次。

根据计算机网络覆盖范围,可将计算机网络分为三类:1、局域网(LAN),是一种在小区域内使用的,由多台计算机组成的网络,覆盖范围通常局限在10千米范围之内;2、广域网(WAN),是一种远程网,涉及长距离的通信,覆盖范围可以是个国家或多个国家,甚至整个世界;3、城域网(MAN),其网络覆盖范围通常可以延伸到整个城市,借助通信光纤将多个局域网联通公用城市网络形成大型网络。

微机的字长是4个字节意味着:在CPU中整体传输和处理的二进制数为32位。因为一个字节是8位长(字长),所以4个字节就是32位了,也就是说cpu中能够同时处理32位的二进制数据。在计算机领域,字是用来表示一次性处理事务的固定长度;一个字的位数,即字长,是计算机一次可处理的二进制数字的数目。

微型计算机的性能主要取决于CPU(中央处理器)的性能。CPU是计算机系统的运算和控制核心,是对计算机的所有硬件资源(如存储器、输入输出单元) 进行控制调配、执行通用运算的核心硬件单元;中央处理器(CPU)的性能对计算机性能起决定性作用。

微型计算机的运算器控制器及内存储器的总称是“主机”。在微型计算机中,运算器、控制器、存储器三个部分是信息加工、处理的主要部件;运算器和控制器总称为CPU(中央处理单元),而CPU与内存储器又总称为主机,这是计算机系统中最核心的硬件部分。

MODEM的功能为“实现模拟信号与数字信号之间的相互转换”。MODEM的中文名为“调制解调器”,它可以在发送端通过调制将数字信号转换成通信线路上传输的模拟信号,在接收端通过解调再将模拟信号转换为数字信号。

世界上第一台计算机的电子元器件是“电子真空管”。世界上第一台计算机是“阿塔纳索夫-贝瑞计算机”,通常简称ABC计算机,采用电子真空管作为电子元件;该计算机电路系统中装有300个电子真空管执行数字计算与逻辑运算,机器使用电容器来进行数值存储,数据输入采用打孔读卡方法,还采用了二进位制。

计算机系统的内部总线主要可以分为5类:1、数据总线,在CPU与RAM之间来回传送需要处理或是需要储存的数据;2、地址总线,用来指定在RAM之中储存的数据的地址;3、控制总线,将微处理器控制单元的信号,传送到周边设备;4、扩展总线,是外部设备和计算机主机进行数据通信的总线,例如ISA总线,PCI总线;5、局部总线,取代更高速数据传输的扩展总线。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

SublimeText3 English version
Recommended: Win version, supports code prompts!

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools
