tags:

views:

37

answers:

3

When multiplying (or doing any mathematics) to binary and decimal numbers, would you simply convert then multiply in decimals?

E.g., 3(base10) * 100(base2) would = 3 * 4 = 12?

A: 

You would convert them to integers before multiplying, I would hope.

Thus they're all in binary.

Anon.
+2  A: 

You can multiply in any base as long as the base is the same for each operand.

In your example, you could have converted the 3(base10) to 11(base2) and multiplied:

11 * 100 = 1100

1100(Base2) = 12(base10)

Jesse Weigert
but i converted mine to base10 * base10 and got a base 10 answer
HollerTrain
Correct. Your answer will be in the same base as what you started with. If you convert everything to binary, your answer will be in binary. If you convert everything to decimal, your answer will be in decimal. You'll get the same answer either way, just in a different base.
Jesse Weigert
awesome. i thought so but wanted to make sure. Ty so much
HollerTrain
Math is awesome like that. Numbers are just numbers.. The base is simply how we choose to represent them.
Jesse Weigert
+1  A: 

Numbers are numbers. 3 * 0b100 will always equal 12, regardless of whether you use a lookup table or bit shifting to multiply them.

Ignacio Vazquez-Abrams
k but since i'm learning, the way i did it was correct? convert one or the other to the same base (in this case base 10) then do simple multiplication?
HollerTrain
It honestly doesn't matter. `3 * 4` is just as valid as `3 * (1 << 2) + 3 * (0 << 1) + 3 * (0 << 0)`.
Ignacio Vazquez-Abrams