看板 Grad-ProbAsk 關於我們 聯絡資訊
┌───┬───┐ │ A │ B │ ├───┼───┤ │ 5323 │ 2275 │ └───┴───┘ 1.What is the sum of A and B if they present signed 12-bit octal numbers stored in sign-magnituded format?The result written in octal. 2.Convert A into a decimal number, assuming it's unsigned. Repeat assuming it stored in sign-magnitude format. 1.已將A轉為二進位 => 101 011 010 011 => -1 3 2 3 B => 010 010 111 101 但是2275-1323=952(答案是752) 請問我是哪裡算錯了? 2.以算出5323(8)=2771(10),請問之後要怎麼做呢?(答案:-723) 感謝!! -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 111.251.137.253 ※ 文章網址: https://www.ptt.cc/bbs/Grad-ProbAsk/M.1482936697.A.819.html
moooner: 1.你應該拿8不是拿10 12/28 22:56
moooner: 我想你應該是用成10+2-3了 12/28 22:58
我懂了!感謝你~
moooner: 2.要sign-mag.化成二進位把最大的1當作負的 12/28 23:06
moooner: 2771-2048=723 12/28 23:07
請問為什麼要把最大的1當負的? 另外第二題是把0147(8)=>103(10) 最後結果也是103 請問和上面那一題的差別在哪裡? 感謝!!
moooner: 因為12bit,看換成2進位最左邊bit是1or0 12/28 23:30
所以是因為5323(8)=>101 011 010 011=>最左邊是1所以是負的 =>2771(10)-2048(10)=723(10)=>加負號 0147(8)=>000 001 100 111=>最左邊是0所以是正的 =>103(10)=>正的不用減?是這樣嗎? 感謝!! ※ 編輯: TampaBayRays (111.251.137.253), 12/28/2016 23:41:25
moooner: 不會啦==我也學到東西這樣 12/28 23:45
kumamae: 5323->101 011 101 011(2) MSB是1是負001 011 101 011(2) 01/08 02:14
kumamae: ->723(10)再加負號 -723 01/08 02:15