how to multiply binary numbers code example

Example 1: binary long multiplication with decimal point

101.1      5.5d
 x  1.01      1.25d
----------
 110.111      6.825d
    ^
    |
    +---- Radix point is placed three places from the least significant bit.
          The top factor has a radix point at one place from the right, and the
          bottom factor has a radix point three places from the right.
          
          1 place + 2 places = 3 places, so we insert a radix point at three places.

Example 2: combine binary numbers

long long result;
result = num1;
result = (result << 8) | num2;
result = (result << 24) | num3;

Tags:

Css Example