2015-03-30 22 views
0

我在網上搜索,但我發現使用的所有例子都帶有位。我很好奇,有沒有一個例子,有人可以告訴我簽名的二進制文件溢出而沒有進位?有人能給我一個沒有進位溢出的簽名二進制文件的例子嗎?

這裏是我工作的具體問題:

Write two 8-bit signed numbers that, if added, produce an overflow, but not a carry. (Write the same numbers in decimal as well as binary - truncate the binary to 8 bits, write the translation of 
the binary answer in decimal.) 

而只是爲了澄清我的理解,承載是當你有這樣的:1 + 1吧?

回答

0

取最大可能的正值(將有一個符號位= 0)並加1;這將導致符號位變化,但不會有進位。

+0

所以在二元方面,我會加上:01111111(127是最大正值)和00000001在一起?但是在右端數字不加1 + 1會導致進位? – Karen 2015-03-30 20:31:42

+0

@Karen是的,還有很多其他的位置,但不是最後(這是「The Carry」的來源) – harold 2015-03-30 20:36:39

+0

哦,我明白了,這很有道理。所以如果他們想要一個能帶來進賬的例子,那麼他們只會走向最後? – Karen 2015-03-30 20:41:12

相關問題