A few days ago
kaicheong57

How many bits will it take to represent the decimal number 3789123?

This is my assignment, my tutor give me the hints : 2power10 * 2 power10 = 1 000 000…… how to got the nearest answer ?

futher question is I got a character string in binary need to change to ASCII , if the code is 1111 0011? the ASCII will wrong ….

add the 0 in left hand side or right hand side?

A few days ago
Anonymous

Take the log base 2 and round up. For instance, log(2) 7 = 2.81. You know that you need 3 bits to handle 7, and there you are.

You probably don’t have a log base 2 key on your calculator, so you can use the change of base formula – take the log base anything of 3789123 and divide by the log (same base) of 2.

In this case,

log(3789123)/log(2) = 21.85, so it’ll take 22 bits.

As a quick check:

2^21 = 2097152, which is less than your value

2^22 = 4194304, which is more.

For your second question, you’ll get an extended ASCII character on any vanilla Windows machine. Extended ASCII are the characters IBM inserted into the second 128 back in the early 80’s. Among them are the ASCII graphics characters that MSDOS used to use to draw boxes and the like. You’ll find an extended ASCII table at

http://www.jimprice.com/ascii-128-255.gif

What you’re looking at is the number 243, which is “≤”.

If you really want to know how it’ll be read by a machine that ignores the high-order bit, then strip off the leading 1 and replace it with a 0. That’ll give you the number 115, “s”.

0