Current location - Training Enrollment Network - Mathematics courses - What is the difference between overflow and carry?
What is the difference between overflow and carry?
Natural number, integer,

After being stored in the computer, it was renamed as unsigned number and signed number.

No matter what number, in the computer, it is represented and stored by "binary machine code".

8 bit binary machine code,

The representative unsigned number ranges from 0 to 255.

The range of representative signed numbers is:-128 ~+ 127.

When the operation result exceeds the above range, it will inevitably overflow.

Overflow should be a common word.

But in the computer designed by Intel, it is divided into "carry" and "overflow".

-

When Intel designed the CPU, two flags were specified.

If the unsigned number operation exceeds the upper and lower bounds, there is: CF = 1, which is called "carry".

If the signed number operation exceeds the upper and lower bounds, there will be: OF = 1, which is called "overflow".

The schematic diagram is as follows: