u use the code 8421
for eg-
the number 678 is represented
as
6-0110
7-0111
8-1000
2006-08-30 17:51:09
·
answer #1
·
answered by elvenprince 3
·
0⤊
0⤋
4 bits per digit is correct but she wanted an expression
(((log base 10 of d) rounded down) plus one) times 4
(floor(log(d))+1)*4
to be sure your using log base 10 you can do as follows
4*(floor(log(d)/log(10))+1)
this gives the right answer in matlab and octave
2006-08-30 19:41:24
·
answer #3
·
answered by jeff.sadowski 2
·
0⤊
0⤋
four bits / digit.
Some examples:
1 = 0001
2 = 0010
7 = 0111
9 = 1001
10 = 1,0 = 0001 0000
12 = 1,2 = 0001 0020
21 = 2,1 = 0010 0001
43 = 4,3 = 0100 0011
4321 = 4,3,2,1 = 0100 0011 0010 0001
4815162342 = 4,8,1,5,1,6,2,3,4,2 = 0100 1000 0001 0101 0001 0110 0010 0011 0100 0010
2006-08-30 18:43:02
·
answer #4
·
answered by selket 3
·
0⤊
0⤋
ceil(log2(d+1))-1
This is because 2^(b+1)-1 (where b is # of bits) is guaranteed to be greater than d, while 2^b-1 is guaranteed to be less than d.
2006-08-30 17:56:52
·
answer #5
·
answered by Alex T 2
·
0⤊
0⤋