看板 TransCSI 關於我們 聯絡資訊
The following binary have a sign in the leftmost bit and negative, are in 2's complement form. Which one in the following computation has overflow occured? (A) 100111+111001 (B) 001011+100110 (C) 110001-010010 (D) 101110+001011 我算的答案是A會產生溢位 但是答案是(C) 我看了一下(C)的解是這樣的: 110001+101110 = [1]011111 →做捨棄→做2的補數→十進位轉換 = -33 (-15) (-18) 我是買坊間的書 不知道有沒有錯 還是我自己搞錯? -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 125.224.160.4
Reddick5566:A作完答案是-32 2's complement中 可表示到-(2^n-1) 01/31 22:12
Reddick5566:A沒溢位 01/31 22:13