[理工] [計組]-台大94-資工

看板Grad-ProbAsk作者 (\( ̄ー ̄;) >)時間16年前 (2009/09/26 00:54), 編輯推噓1(105)
留言6則, 4人參與, 最新討論串1/1
Perform the following 8-bit 2's complement number operation and check whether arithmetic overflow occurs. Check your answer by converting to decimal sign-and-magnitude representation. 1 1 0 1 0 0 1 1 - 1 1 1 0 1 1 0 0 題目是這樣@@ 我的問題是 "Check your answer by converting to decimal sign-and-magnitude representation." 這一句話 是否代表要將1 1 0 1 0 0 1 1與1 1 1 0 1 1 0 0 用sign-and-magnitude方式,化成10進位數,在相減變成答案呢? 也就是 1 1 0 1 0 0 1 1= -(64+16+2+1) = -83 1 1 1 0 1 1 0 0= -(64+32+8+4) = -108 然後-83-(-108)=25 (這是錯的 因為答案是-25) -- 張凡的答案是直接把那兩式用2's complement的方式化成10進位 -45-(-20)=-25 還是我誤解題意了... 請高手幫我回答 感謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 61.227.98.199

09/26 01:10, , 1F
應該是指先做2's補數的減法,看是不是有overflow
09/26 01:10, 1F

09/26 01:12, , 2F
之後再換成常用的10進制也計算一次,確認答案是不是正確
09/26 01:12, 2F

09/26 01:34, , 3F
題目不是要做2補數嗎?_?a
09/26 01:34, 3F

09/26 04:32, , 4F
decimal sign-and-magnitude representation是一整個字
09/26 04:32, 4F

09/26 08:04, , 5F
歐...原來那算一個字= = 那我懂了
09/26 08:04, 5F

09/26 08:04, , 6F
感謝
09/26 08:04, 6F
文章代碼(AID): #1AlFNRdB (Grad-ProbAsk)