0

1010000/1011 using Binary Modulo 2 Division remainder is 011. i.e 80/11 remainder =3. I know how to do it in binary but how can I calculate above result using decimal values 80 and 11.

Kanika
  • 9
  • 4

1 Answers1

0

Modulo 2 division and integer division are two different things. They do not, in general, give the same results.

In the particular example you gave, just by chance, they do give the same result, 3.

You cannot compute the modulo 2 division remainder using arithmetic division. You have to use bit operations.

Mark Adler
  • 101,978
  • 13
  • 118
  • 158
  • I agree. But my question is what if I want to do Modulo 2 Division using integers. For eg. If I want to do bitwise left shift , I simply multiply its integer value or decimal value into 2. i.e. 1010<<1 = 10100 operation is equivalent to 10*2 =20. Similary If i want to do Modulo 2 Binary Division using int or decimal value then how can I do it? – Kanika Feb 12 '17 at 19:28
  • A shift right of an integer is the same as dividing by two, since the low bit after the division is discarded. However there are no arithmetic operations that will allow you to easily implement exclusive-or. You need a bit-wise exclusive-or operation to compute the modulo-2 remainder. – Mark Adler Feb 12 '17 at 19:30