To perform addition and subtraction in fixed-point arithmetic, you first align the decimal points of the two numbers. Then you add or subtract the two numbers digit by digit, starting from the rightmost digit and moving left. If there is a carry from one digit to the next, you add it to the next digit. If there is a borrow from one digit to the next in subtraction, you borrow from the next digit.
For example, consider the addition of two fixed-point numbers with three digits after the decimal point:
123.456 + 789.012
To add these numbers, you first align the decimal points:
123.456
789.012
Then you add the two numbers digit by digit:
123.456
789.012
-------
912.468
So the sum of these two numbers in fixed-point arithmetic is 912.468.
Subtraction is performed in a similar way.
For example, consider the subtraction of two fixed-point numbers with three digits after the decimal point:
789.012 - 123.456
To subtract these numbers, you first align the decimal points:
789.012
123.456
Then you subtract the two numbers digit by digit:
789.012
123.456
-------
665.556
So the difference between these two numbers in fixed-point arithmetic is 665.556.