Differences between CF and

Source: Internet
Author: User

The difference between the carry mark CF and the overflow mark:

The number of signed symbols and the number of unsigned symbols are only considered to be differentiated. Computers never distinguish between the number of signed symbols and the number of unsigned symbols. For the number of operations, as long as it meets the carry condition, CF sets 1. as long as the overflow condition is met, of sets 1. however, in subsequent operations such as numerical judgment, the number of symbols is mostly based on the CF mark, and the number of symbols is based on the mark. If the two numbers are compared, the unsigned number is performed according to the CF flag, and the signed number is based on the of flag.

 

• How to Determine the overflow of computer hardware is as follows:
The highest bit has an ascending bit, but the secondary high has no carry, or the highest bit has no carry but the secondary high has a carry; that is, the highest bit and the secondary high have a carry-only one. (Overflow occurs when the highest bit and the secondary high bit are inconsistent)

• We do not use this mechanical method on machines. We can use the following rules (compilation of the second edition of the textbook, page 19th ):
Overflow occurs only when two identical symbols are added (including two different symbols minus each other), and the symbols in the calculation result are opposite to the original data symbols.

• Example: 3ah + 7ch = 00111010b + 01111100b = 10110110b = b6h
The first high is 0 and the other is 1, but there is also a low carry 1, so the second High has a forward bit; the highest two 0, there is a high carry, the result is only 1 no carry, therefore, the computer determines that an overflow exists.
In our judgment, we can see that the highest bit. The two numbers have the same highest bit as 0. After the sum, the highest bit is 1, so there is overflow.

For example, 3ah + 8dh, we can immediately determine that there is no overflow. Because this is the sum of two different symbols.

The debugging program can help you verify.

The data is converted based on the number of symbols to obtain the true value in decimal format, and then the result can be determined. However, this is not as easy as the preceding rules.

 

References:

Http://www5.zzu.edu.cn/qwfw/ynjd/clqjg/4a44c05f3f5a870e013f6424857a043d.html

Differences between CF and

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.