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

N bit and m bit numbers

  1. Oct 5, 2014 #1
    Hi guys,

    I sure this is an astonishingly dumb question, but I am new to embedded systems, so dont be too harsh.

    I am taking embedded systems in final year at uni and working through some introductory tutorial sheets.

    One question asks;

    -If two n-bit numbers are added together, what memory size is required to hold the result?

    -If two n-bit numbers are multiplied together, what memory size is required to hold the result?

    -If an n-bit number is multiplied with an m-bit number, what memory size is required to hold the result?

    What is an n-bit number and how does it differ to an m-bit number??? I assume they are just to variable integers, and at first I presumed they could just be any size, but I would not know how to express the answer if this were the case.
  2. jcsd
  3. Oct 5, 2014 #2


    User Avatar
    Homework Helper

    m and n just represent some integer value. For a computer, the common values would be 8, 16, 32, 64. What's missing from these questions is if the numbers are signed or unsigned.
  4. Oct 5, 2014 #3


    User Avatar
    Science Advisor

    The best way to understand this is through logs (in base 2).

    If you have n bits for a word then you have 2^n possible values.

    For addition this means you need to calculate log_2(2^n + 2^m) and round up where necessary. If m = n then you have the situation where log_2(2^m + 2^n) = log_2(2*2^m) = log_2(2^(m+1)) = m+1 bits.

    For multiplication you have log_2(2^m * 2^n) = log_2(2^(m+n)) = m + n bits.

    You can use the same sort of rules for all other operations to find the number of bits.
  5. Oct 5, 2014 #4
    Ok, that makes sense, I have just assigned a number to n and m as it makes it easier for me to follow the logic and it calculates as you would expect.

    Thanks for the help guys, much appreciated!!!
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook