Python series------Computer operation process

Source: Internet
Author: User

How the computer does the arithmetic

in a computer system, the values are all represented by the complement.

    • A positive complement

Positive complement and source code are the same.

    • The complement of negative numbers

The sign bit is unchanged, and the other bits are reversed plus 1.

An expression

Convert to Anti-code

Shift to complement

Calculation results

Switch to source code

10+2

0000 1010

+

0000 0010

0000 1010

+

0000 0010

0000 1100

0000 1100

+ ( -2)

0000 1010

+

1111 1101

0000 1010

+

1111 1110

0000 1000

0000 1000

All ( -4)

0000 0011

+

1111 1011

0000 0011

+

1111 1100

1111 1111

1000 0001

Note: Positive inverse code is the same as the source code is the same, negative inverse code is negative absolute value of the bitwise negation, complement is negative absolute value reversed, sign bit unchanged plus a


This article from "Technology bo" blog, declined reprint!

Python series------Computer operation process

Related Article

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.