1
$\begingroup$

Is it true that adding two numbers in base 2 is more complex than multiplying them? If so can someone please explain why this is the case?

$\endgroup$
1
  • $\begingroup$ To add floating point numbers you first need to put them on a “common denominator”, which isn’t necessary for multiplication. $\endgroup$ – Yuval Filmus Mar 28 at 5:51
0
$\begingroup$

Floating point numbers are stored as $x \cdot 2^e$, where typically $1 \leq x < 2$ (unless your number is denormalized). When multiplying $x \cdot 2^e$ and $y \cdot 2^f$, we simply compute $xy \cdot 2^{e+f}$ (we have to truncate $xy$). When adding $x \cdot 2^e$ and $y \cdot 2^f$, we first have to shift one of the numbers (the one with smaller exponent) so that we have a "common denominator". For example, to add $1 \cdot 2^0$ and $1 \cdot 2^{-3}$, you have to rewrite the latter as $0.125 \cdot 2^0$.

Whether this makes addition more complex than multiplication is a matter of opinion. Multiplying $x$ and $y$ is still harder than addition.

$\endgroup$
0
$\begingroup$

The straightforward algorithm is more complicated than the straightforward algorithm for multiplication. For addition, you need to compare the exponents, shift the mantissa of the operand with smaller exponent, add or subtract (the signs might be different) and then check for overflow or check for an unnormalised result. Lots of complicated steps.

For multiplication, you multiply the mantissas, normalise the product of mantissas, check for overflow and under flow. Much simpler.

However, the number of operations for the multiplication is much higher, quadratic for typical fast hardware implementations. It’s just easier to describe.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.