A = 0 10011 0011110111

B = 1 00011 0010011000

exponent is 15, mantissa is 10 bits and first bit is implicit. Can somebody please tell me the final answer cause I am having trouble figuring out what is happening with exponent since there are 3 extra zeroes in front of mantissa multiplication. I got that exponent is 7(00111 in binary). Thanks in advance


When multiplying floating points:

  1. we add the (real) exponents, to get the output exponent
  2. we multiply the two mantissas (remember the implied 1), round and shift as necessary.

So the new exponent is $E=(19-15) + (3-15)= -8$.

The multiplication of the mantissas give $$1.0011110111_2 \times = 1.0010011000_2 = 1.01101100111010101$$

taking only 10 digits (rounding down, see here) we get $M= 0110110011$.

The sign is a minus.

So the output is $Out= 1\ 00111\ 0110110011$.

For sanity check, let's convert to decimal and see that it makes sense.

$A = (-1)^0 \times 2^{4} \times 1.2412109_{10} = 19.8593744$

$B = (-1)^1 \times 2^{-12} \times 1.1484375_{10} = -0.0002804 $


$A\cdot B = -0.0055686$

We can convert $Out$ from above to decimal, and get $Out = (-1)^1 \times 2^{-8} \times 1.4248047 = -0.0055656$ and the error is $0.000003 \approx 2^{-18}$ which makes sense (since the real exponent is $2^{-8}$ and we have a 10 digit significand)

See also https://oletus.github.io/float16-simulator.js/ for a calculator, and https://en.wikipedia.org/wiki/Half-precision_floating-point_format or https://en.wikipedia.org/wiki/Floating_point for definition and some more explanations.

  • $\begingroup$ I got 1 00111 011011 0011 by multiplying both mantises, I got 101 as guard digit, round digit and sticky bit but since the signs are different it doesn't change anything, what did I miss to get 0011 instead of 1110 ? $\endgroup$
    – vucko95
    Mar 27 '16 at 23:21
  • $\begingroup$ No, you are correct. My answer performs the multiplication in the decimal basis, then converting back to half-point (hence, the $\approx$; and since your question was about the exponent anyways). But note that rounding the $0011...$ should probably give you $0100$, no? $\endgroup$
    – Ran G.
    Mar 27 '16 at 23:36
  • $\begingroup$ In my notes it says if the signs of the numbers that I am multiplying is same then I add that 1 to result. When they are different just like in this case (a -0 , b-1) then the result stays the same. I don't know if that's correct but that said the professor. I hope it is correct .Thank you $\endgroup$
    – vucko95
    Mar 27 '16 at 23:43
  • $\begingroup$ "The IEEE standard for floating point arithmetic requires that the programmer be allowed to choose 1 of 4 methods for rounding:; see for instance pages.cs.wisc.edu/~markhill/cs354/Fall2008/notes/… for a nice explanation. It seems your Prof uses method 2? $\endgroup$
    – Ran G.
    Mar 28 '16 at 0:08
  • $\begingroup$ In my task it says, find A*B and round it with round to nearest together with round away from zero. Probably I understood question wrong. But there is this thing that if at the I end is 101 I have to look at the sign of the numbers to decide if I should change mantisa. So with round away from zero and round to nearest it is 1 00111 011011 0100? $\endgroup$
    – vucko95
    Mar 28 '16 at 19:00

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.