Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Probably simple decimal/binary conversion

  1. Nov 10, 2011 #1
    1. The problem statement, all variables and given/known data
    This is a question on a homework assignment, and of course I'm not expecting a direct answer but just a way to figure out how to get what I need to know.

    The question is: Take you 8-digit student number (20248462 in this example) and convert this to a 24 bit equivalent binary number string. Make the proper adjustments to make your results 24 bit.

    2. Relevant equations

    3. The attempt at a solution
    First I just tried a direct changing of the student number to binary and got 111101110010110001110111101110010110001110, which is quite a bit larger than 24 bits. Then I tried treating each number as a hex value, but obviously 8*4 = 32bits. I then thought to do it as scientific notation like a floating point value, but again, we only can do that as 32 bits.

    So how do I go about doing this? I'm sure it's something easy and I'm just being stupid.
    Last edited: Nov 10, 2011
  2. jcsd
  3. Nov 10, 2011 #2


    Staff: Mentor

    How did you get this number? It's way larger than it should be.The binary representation of 20248462 will fit in 25 bits. I don't know what trick you need to use to squeeze it into 24 bits.
  4. Nov 10, 2011 #3
    The largest number that may be represented with an (unsigned) 24 bit binary integer is 2^24 - 1 = 16777215

    20248462 > 16777215

    But you didn't do the conversion right anyway.
  5. Nov 10, 2011 #4
    Yeah, I figured that out (having got it as 25 bits earlier). I copied the wrong number from the work I've been doing. It's actually 1001101001111011110001110, but yeah, I looked through all the course material and there is nothing on turning 20248462 into a 24bit binary number.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook