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!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver Mac version
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version
Useful JavaScript development tools