再谈计算机补码-并非 除符号位,其余数值位取反加1

先贴上补码的定义:Two’s Complement
其次是反码的定义:One’s Complement

======以上链接可能需要科学上网,若不能打开,可先不看,我将在下面用原文给出======

One’s Complement:

The ones’ complement of a binary number is the value obtained by
inverting all the bits in the binary representation of the number
(swapping 0s and 1s). This mathematical operation is primarily of
interest in computer science, where it has varying effects depending
on how a specific computer represents numbers.
//上面这段话指出反码是将所有bit位全部取反(cpu并不知道数值有无符号,要配合标志位识别符号位,下面英文指出计算机采用的更巧妙的补码操作算法,可不看)。
A ones’ complement system or ones’ complement arithmetic is a system
in which negative numbers are represented by the inverse of the binary
representations of their corresponding positive numbers. In such a
system, a number is negated (converted from positive to negative or
vice versa) by computing its ones’ complement. An N-bit ones’
complement numeral system can only represent integers in the range
−(2N−1−1) to 2N−1−1 while two’s complement can express −2N−1 to
2N−1−1. It is one of three common representations for negative
integers in microprocessors, along with two’s complement and
sign-magnitude.

The ones’ complement binary numeral system is characterized by the bit
complement of any integer value being the

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值