Talk about the complement 1.

Source: Internet
Author: User

for the complement has always only know the application method, is the positive complement is its own, the complement of negative numbers is its corresponding positive number of each to take the inverse plus one, so that the subtraction operation can be achieved by adding. But has not been very clear about its principle, today to break apart and knead a chat.  

The complement is derived from the concept and method of mathematical complement, so the understanding of complement must first understand the complement.

Number of complements

The definition of a complement (radix comletment): There is a number with a base of B, and a digit of n is the complement of the y,y of B minus Y. For example, the cardinality is 10, and the complement of three digits 123 is 877 (1000-123).

The definition of reduced radix complement (diminished radix complement): B's N-th minus 1 minus y. For example, a base number of 10,123 is a reduction base complement of 876 (1000-1-123).

Why is there a reduction in the cardinality of the complement, because it is more convenient to calculate. Mathematically it can be proved that the N-square minus 1 minus y of B can be obtained, and each digit of y is subtracted by b-1. For example, the above example, 9 (10-1) -1,9-2,9-3 can be obtained by the reduction of the number of Y-complement of the hundred, 10-bit and digit. As for and proof, you can Google yourself.

The principle of subtraction addition can be realized

There are two ways to implement subtraction with addition.

The first is to use the reduction base complement of X plus y to get an X-y reduction base complement.


The second, X plus Y's complement can get an X-y value.

Cond...

My level is limited, but welcome to communicate.

If you feel a little bit interesting, welcome to Goku's little garage.

Talk about the complement 1.

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.