Binary arithmetic, logical operation


\quad \quad Binary is a number system widely used in computing technology. Binary data is a number represented by two digits, 0 and 1. Its base is 2, the carry rule is "every two enters one", and the borrow rule is "borrow one to become two", which was discovered by Leibniz, a German mathematician and philosophy master in the 18th century. The current computer system basically uses a binary system, and data is mainly stored in the computer in the form of complement. Binary number operations include arithmetic operations and logical operations.

1. Arithmetic operations

1.1 Rules of addition operation

Rule : Every second enters one
example :
Insert picture description here

1.2 Rules of subtraction operation

Rules : Borrowing one and two
examples :
Insert picture description here

1.3 Multiplication rules

Rule : What is multiplied by
example :
Insert picture description here

1.4 Division operation rules

Rule : The division operation of binary system is similar to that of decimal system, and there is no carry or borrow.
Example :
Insert picture description here

1.5 Negative numbers

The representation of negative numbers in binary: the inverse of a positive number plus 1
5: 00000000 00000000 00000000 00000101
The inverse of 5: 11111111 11111111 11111111 11111010
-5: 11111111 11111111 11111111 11111011

2. Logic operations

See previous bit operation blog post

Guess you like

Origin blog.csdn.net/weixin_45666566/article/details/113034995