Home >Common Problem >What are the rules for addition, subtraction, multiplication and division?

What are the rules for addition, subtraction, multiplication and division?

烟雨青岚
烟雨青岚Original
2020-06-16 09:22:0821163browse

What are the rules for addition, subtraction, multiplication and division?

What are the rules for addition, subtraction, multiplication and division?

Addition, subtraction, multiplication and division are the four basic arithmetic operations. In the absence of parentheses, the order of operations is multiplication and division first, then addition and subtraction.

Commutative law of addition: a b=b a

Associative law of addition: a b c=a (b c)

Commutative law of multiplication: a*b=b*a

Associative law of multiplication: a*b*c=a*(b*c)

Distributive law of multiplication: (a b)*c=a*c b*c

Properties of subtraction : a-b-c=a-(b c)

Properties of division: a/b/c=a/(b*c)

Principles of computer addition, subtraction, multiplication and division

Principles of addition and subtraction: Original code, inverse code, complement code

Machine number: the actual storage of numerical values ​​in the computer; For example, [2] is [00000010], [-2] is [10000010]; its highest bit is called the sign bit, 0 represents a positive number, and 1 represents a negative number.

The true number of the machine number: the true value of the machine number, such as [2] is [0000010], [-2] is [0000010], etc.

Original code: The sign bit plus the absolute value of the real number, using the first bit to represent the sign and the remaining bits to represent the value.

Inverse code: The complement code of a positive number is itself; the complement code of a negative number is based on its original code, the sign bit remains unchanged, and the remaining bits are inverted.

Complement code: The complement code of a positive number is itself; the complement code of a negative number is based on its original code, the sign bit remains unchanged, the remaining bits are inverted, and finally 1.

Principle of multiplication: computer values ​​are expressed by 2 raised to the Nth power:

2^n0 2^n1 2^n2 2^n3 2^n4......

x*y

=(x)*(2^n0 2^n1 2^n2 2^n3 2^n4)

=(x*2^n0) (x*2^n1) (x*2^n2) (x*2^n3) (x*2^n4) ......

=(x moves left n0) (x moves left n1) (x moves left n2) (x moves left n3) (x moves left n4) ......

Principle of division: left shift operation, the sign bit does not participate in the operation.

For more related knowledge, please visit PHP Chinese website! !

The above is the detailed content of What are the rules for addition, subtraction, multiplication and division?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn