Arithmetic codes can be sorted into non-separable arithmetic codes and separable arithmetic codes. The simplest non-separable codes is AN codes, and the simplest separable codes is residue codes. AN codes are formed by multiplying the operands by a constant. Residue code are formed by attaching the operands with a separate check symbol, which is the residue of the operands divided by a constant.

AN codes:

Input data words and encoding constant:

Data Word X: 11011, Data Word Y: 1100, Encoding Constant: 11

Encoded Word X: 1010001, Encoded Word Y: 100100

Modify the 2nd-order bit of Encoded Word Y

Encoded Word X: 1010001, Encoded Word Y: 100110

Push the "Calculate Next Bit" button for 4 times,

Carry-in: 0000, Partial sum: 0111

Modify the MSB of the carry-in:

Carry-in: 1000, Partial sum: 0111

Push "calculate next bit" button until we get the final sum (Encoded Word Z):

Encoded Word Z: 10000111

Decode the final sum:

Correct Word Z: 100111, Correct Remainder: 0

Decoded Word Z: 101101, Remainder: 0

Residue codes:

Input data words and encoding constant:

Data Word X: 11011, Data Word Y: 1100, Encoding Constant: 3

Encoded Word X: 11011 00, Encoded Word Y: 1100 00

Modify the LSB bit of Encoded Word Y

Encoded Word X: 11011 00, Encoded Word Y: 1101 00

Push the "Calculate Next Bit" button for 4 times,

Carry-in: 1111, Partial sum: 1000

Modify the MSB of the carry-in:

Carry-in: 0111, Partial sum: 1000

Push "calculate next bit" button until we get the final sum (Encoded Word Z):

Encoded Word Z: 011000 00

Decode the final sum:

Correct Word Z: 100111, Correct Remainder: 00

Decoded Word Z: 011000, Remainder: 00

AN codes:

Input data words and encoding constant:

Data Word X: 11011, Data Word Y: 1100, Encoding Constant: 11

Encoded Word X: 1010001, Encoded Word Y: 100100

Push the "Calculate Partial Product" button:

0000000

0000000

1010001

0000000

0000000

1010001

Flip the two red bits:

0000000

0000000

1000001

0000000

0000000

1010000

Calculate the final product (Encoded Word Z):

Encoded Word Z: 101100000100

Decode the final product:

Correct Word Z: 101000100, Correct Remainder: 0

Decoded Word Z: 100111001, Remainder: 0

Residue Codes:

Input data words and encoding constant:

Data Word X: 11011, Data Word Y: 1100, Encoding Constant: 11

Encoded Word X: 11011 00, Encoded Word Y: 1100 00

Push the "Calculate Partial Product" button:

00000

00000

11011

11011

Flip the two red bits:

00000

00000

01011

11010

Calculate the final product (Encoded Word Z):

Encoded Word Z: 11111100 00

Decode the final product:

Correct Word Z: 101000100, Correct Remainder: 00

Decoded Word Z: 11111100, Remainder: 00