Binary Multiplication: how many bits is a product
Asked Answered
F

3

10

If you are multiplying two binary numbers, one with n number of bits and one with m number of bits, how many bits is the product? For ex., if I multiply a binary number of 6 bits and a binary number of 8 bits, how many bits will the product be?

Fiance answered 22/9, 2015 at 15:35 Comment(0)
F
9

When you multiply two numbers, the number of bits in the product cannot be less than max(m,n) and cannot be more than (m+n). (Unless one of the two numbers is a 0).

In your example, with m = 6 and n = 8.

The minimum number of bits in the product will be 8 and the maximum will be 14.

Feldman answered 22/9, 2015 at 15:38 Comment(0)
C
0

Looking at this question in terms of functions, you can use the logarithm base 2. So for example if we have two numbers a and b (and for the sake of clarity lets say a has n bits and b has m bits.) You would arrive at these values by taking the log_2 of both numbers:

log_2(a) = n ; log_2(b) = m

Now if you want the number of bits of the product, you can use a property of the logarithm:

log_2(a*b) = log_2(a) + log_2(b)

So you get the number of bits of the product! This will be an upper bound for your size, but it works quite well.

Christo answered 27/6, 2023 at 16:50 Comment(0)
B
0

For m and n, minimum is m+n-1 and maximum is m+n. Therefore, 8 and 6 give 13 and 14 respectively.

Beniamino answered 15/9, 2023 at 15:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.