What does the form of complement in c mean?

Updated on society 2024-03-21
4 answers
  1. Anonymous users2024-02-07

    That is, the original code of the positive number is itself, the original code of the negative number is the reverse code plus one, and the reverse code is all the negation except for the sign bit.

  2. Anonymous users2024-02-06

    Assuming that the current hour hand points to 10 o'clock and the exact time is 6 o'clock, there are two ways to adjust the time:

    One is to reverse 4 hours, that is: 10-4=6

    The other is to dial 8 hours: 10 + 8 = 12 + 6 = 6

    In a 12-mode system, adding 8 and subtracting 4 have the same effect, so all subtract 4 operations can be replaced by adding 8.

    For modulus, 8 and 4 are complementary to each other. In fact, in a 12-mode system, 11 and 1, 10 and 2, 9 and 3, 7 and 5, 6 and 6 all have this feature.

    Sex. The common feature is that the sum of the two equals the modulo.

    For computers, the concept and approach are exactly the same. N bit computer, let n = 8, the maximum number that can be represented is 11111111, if you add 1 more is called 100000000 (9 bits), but because there are only 8 bits, the highest bit 1 is naturally lost. It's back to 00000000, so the modulo of the 8-bit binary system is 2 8.

    In such a system, the subtraction problem can also be reduced to an addition problem, and the subtraction can be represented by the corresponding complement.

    The use of complements in the processing of computer logarithms is called complements.

    In computer systems, numerical values are always represented (stored) by complements. The main reason: with complement, the sign bit can be unified with other bits; At the same time, subtraction can also be handled by addition.

    Find the complement: The complement of a positive number is the same as the original code.

    The sign of the composite sign of the negative number is 1, and the rest of the digits are the original code of the absolute value of the number, which is inverted by bit; Then add 1 at the end.

  3. Anonymous users2024-02-05

    Complement is the format in which positive and negative numbers are stored in a computer.

    Inside the computer, there is no "positive code" or "reverse code".

    The C language is a high-level language.

    Programming in a high-level language doesn't have to worry about the inside of the computer.

    If you have to go into the details inside a computer, it's not a high-level language.

    Many authors of textbooks and books do not understand what a high-level language is.

    There are many kinds of codes inside the computer, and if you discuss it, you won't be able to learn the C language.

  4. Anonymous users2024-02-04

    Numeric values are expressed in the form of machine numbers, computers can only recognize 0 and 1, and use binary, while in everyday life people use decimal system"As Aristotle pointed out long ago, the widespread adoption of the decimal system today is simply a consequence of the anatomical fact that the vast majority of us are born with 10 fingers. Although historically, the practice of finger counting (5,10) appeared later than the advent of binary or terrestrial counting. "(Excerpt from "The History of the Development of Mathematics", you can take a look at it if you have time, it's very interesting).

    In order to facilitate the conversion to binary, hexadecimal (2) is used

    4) and octal (23).Let's get down to business.

    There are positive and negative values, and the computer uses the highest digit of a number to store the symbol (0 is positive, 1 is negative).This is the source code of the number of machines. Let's say the number of bits that the machine can handle is 8That is, the word length is 1 byte, and the range of the original code can represent the value is.

    0 127) of 256.

    With the notation of numerical values, it is possible to perform arithmetic operations on numbers. However, it was soon found that the result was correct when the multiplication and division operation was performed with the original code with signed bits, and the problem occurred in the addition and subtraction operation, as follows:

    Let's assume that the word length is 8bits

    00000001) Original.

    10000001) Original.

    10000010) Original.

    Clearly incorrect.

    Because there is no problem in the addition of two integers, it is found that the problem appears in the negative number with the signed bit, and the negation of the rest except the sign bit by bit produces an inverse code. The value space of the inverse code is the same as that of the original code and corresponds one-to-one.

    Here's the subtraction of the inverse code:

    Anti + (11111110) Anti.

    11111111) Anti.

    There is a problem. Anti + (11111101) Anti.

    11111110) Anti.

    The correct question arises at (+0) and (-0), and there is no positive or negative distinction between zero and zero in people's computational concepts. (The Indians first marked zeros and put them into the arithmetic, and Indian mathematics and decimal counting, which included zeros, made great contributions to human civilization).

    This is where the concept of complement is introduced.

    The complement of a negative number is to add one to the reverse code, while the positive number does not change, and the original code of the positive number is the same as the reverse code complement. (-128) is used instead of (-0) in the complement, so the complement can be represented in the range:

    128 0 127) 256 in total.

    Note: (-128) does not have the corresponding original code and reverse code, (-128).

    The addition and subtraction of the complement is as follows:

    00000001) Supplement.

    11111111) Supplement.

    000000000).

    Correct Complement + Complement = (11111111) Complement.

    Correct so the purpose of the complement is to:

    Simplifies the rules of operation by enabling the sign bits to participate in the operation along with the valid value part.

    Converts subtractive operations into additive operations, further simplifying the circuit design of combinators in computers.

    All of these conversions are done at the very lowest level of the computer, while the other high-level languages we use such as assembly, C, etc., are all in the source code.

Related questions
9 answers2024-03-21

The so-called handle is actually a piece of data, a long piece of data. >>>More

3 answers2024-03-21

3c=three corridors.It is an RPG of War3 and is popular with the majority of War3 players. Especially the welcome of the students on the university campus. >>>More

7 answers2024-03-21

2c means:It is the meaning of business to customer, the pronunciation of 2 in English is the same as to, business-to-customer is the meaning of business to customer, abbreviated as b2c, and its Chinese abbreviation is "business to customer." >>>More

4 answers2024-03-21

1. Ji is in ancient times.

It's a kind of surname that already exists. Later, it was extended to the good name of women, and it was extended to refer to concubines. >>>More

4 answers2024-03-21

Verb forms refer to words that are used to denote an action or state. >>>More