# N bit and m bit numbers

1. Oct 5, 2014

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.

-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. Oct 5, 2014

### rcgldr

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.

3. Oct 5, 2014

### chiro

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.

4. Oct 5, 2014