看板 Grad-ProbAsk 關於我們 聯絡資訊
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
BF3716:應該是指先做2's補數的減法,看是不是有overflow 09/26 01:10
BF3716:之後再換成常用的10進制也計算一次,確認答案是不是正確 09/26 01:12
bernachom:題目不是要做2補數嗎?_?a 09/26 01:34
ssccg:decimal sign-and-magnitude representation是一整個字 09/26 04:32
kizu1124:歐...原來那算一個字= = 那我懂了 09/26 08:04
kizu1124:感謝 09/26 08:04