進制轉換的問題

2011-03-07 7:15 pm
1. 分數可轉進制嗎?如 23/35(10) = ____(2)?
2. 小數怎樣轉進制?如16.92(10) = ____(2)?
3. 負數怎樣轉進制?如-20(10) = ____(2)?

回答 (2)

2011-03-12 5:47 am
✔ 最佳答案
1.
23*2 / 35 = 1 .. 11
11*2 / 35 = 0 .. 22
22*2 / 35 = 1 .. 9
9*2 / 35 = 0 .. 18
18*2/ 35 = 1 .. 1
1*2 / 35 = 0 .. 2
2*2 / 35 = 0 .. 4
4*2 / 35 = 0 .. 8
8*2 / 35 = 0 .. 16
16*2 / 35 = 0 .. 32
32*2 / 35 = 1 .. 29
29*2 / 35 = 1 .. 23
23*2 / 35 = 1 .. 11 (重複)
故 23/35 改為2進位
= (0.101010000011 101010000011 101010000011 ...(repeat)

2.
16 改為2進位 = (10000)_2 = B10000
0.92= 23/25
23*2 / 25 = 1.. 21
21*2 / 25 = 1.. 17
...
0.92= 23/35 改為2進位
=0.11101011100001010001 11101011100001010001 ..(repeat)
故 16.92改為2進位
=10100.11101011100001010001 11101011100001010001 ..(repeat)


3.
-20=-(16+4)= -(10000+100)= -10100
or
10000000 - 00010100 = 0110 1100 (2's complement for a byte)

2011-03-12 13:18:20 補充:
更正: (原作答少算一個0)
20= B00010100
-20 = B11101011 +1 =B11101100
or -20=B100000000 - B00010100 =(取8bits)B11101100

2011-03-12 13:22:41 補充:
無法補充作答,故補充在意見欄

2011-03-12 18:45:05 補充:
1. 取8bits(1byte)當一個數,最多有2^8=256種,故可表示256種整數值
含正負與0, 則其值為 -128~+127
2. 取8bits時, 第9bits以上刪除,故B100000000-B00010100= B11101100
相當於 0- 20= -20
3. 例: 35=B00100011
35+(-20)=B00100011+B11101100=B100001111(取8bits)=B00001111=15
OK!?
2011-03-12 6:31 pm
Thank you!
but I don't understand this sentence:
10000000 - 00010100 = 0110 1100 (2's complement for a byte)

2011-03-12 15:25:05 補充:
B100000000不是等於 256 嗎?
那麼256 - 20= 236??和20有甚麼關係?甚麼取 8 bits?
B11101011= 235 , 235+1 = 236,236和20有甚麼關係?
小弟學識尚淺,祈昐您能解釋給小弟。


收錄日期: 2021-05-04 00:56:46
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20110307000051KK00301

檢視 Wayback Machine 備份