Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【Q672】什么是原码、补码与反码 #690

Open
shfshanyue opened this issue Jul 23, 2021 · 1 comment
Open

【Q672】什么是原码、补码与反码 #690

shfshanyue opened this issue Jul 23, 2021 · 1 comment
Labels

Comments

@shfshanyue
Copy link
Owner

No description provided.

@shfshanyue
Copy link
Owner Author

shfshanyue commented Jul 23, 2021

  • 原码:
  • 反码: 反码按位取反
  • 补码: 正数和0的补码就是该数字本身,负数的补码则是反码加一

补码

0 1 1 1 1 1 1 1 = 127
0 0 0 0 0 0 1 0 = 2
0 0 0 0 0 0 0 1 = 1
0 0 0 0 0 0 0 0 = 0
1 1 1 1 1 1 1 1 = −1
1 1 1 1 1 1 1 0 = −2
1 0 0 0 0 0 0 1 = −127
1 0 0 0 0 0 0 0 = −128

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant