补,为什么叫"二" [英] two's complement, why the name "two"

查看:190
本文介绍了补,为什么叫"二"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道签名,二补,一补数和标志幅度和它们之间的区别,但我很好奇的是:


  1. 为什么它被称为二的(或1')的补充,所以有一个更概括狮集团的补充?

  2. 在哪条路没有这些天才演绎出这样一种自然的方式来重新present负数?


解决方案

二补出来时,有人意识到减去了'走出负面 1 0 ,让rollunder实际上是由符号的算术简单,因为没有专门的检查都要做检查,如果数字为负或不位。其他的解决方案,为您和之间的不连续性-1 0 。与补的唯一古怪的是,你得到一个负号在你的射程比你有正数。但是,随后,其他的解决方案给你喜欢怪事+ 0 -0

根据维基百科,这个名字本身来自于数学和基于减法制作简单,当你有数量有限的地方的方法。该系统实际上是一个补码,并自二是基地二,这成为两补。而事实证明,一补是命名为缩水基数补,这是基数减一。如果你看一下这个十进制,名字背后的含义更有意义。

补充(维基百科)的方法

i know unsigned,two's complement, ones' complement and sign magnitude, and the difference between these, but what i'm curious about is:

  1. why it's called two's(or ones') complement, so is there a more generalize N's complement?
  2. in which way did these genius deduce such a natural way to represent negative numbers?

解决方案

Two's complement came about when someone realized that 'going negative' by subtracting 1 from 0 and letting the bits rollunder actually made signed arithmetic simpler because no special checks have to be done to check if the number is negative or not. Other solutions give you a discontinuity between -1 and 0. The only oddity with two's complement is that you get one more negative number in your range than you have positive numbers. But, then, other solutions give you strange things like +0 and -0.

According to Wikipedia, the name itself comes from mathematics and is based on ways of making subtraction simpler when you have limited number places. The system is actually a "radix complement" and since binary is base two, this becomes "two's complement". And it turns out that "one's complement" is named for the "diminished radix complement", which is the radix minus one. If you look at this for decimal, the meanings behind the names makes more sense.

Method of Complements (Wikipedia)

这篇关于补,为什么叫"二"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆