forestbelton/fp — Issue #1: Fix subtraction
Author: forestbelton
Created: 2012-02-24 16:37:22+00:00
State: open

Consider the following scenario, where you have two values like 38 and 29. Clearly, 38 - 29 is positive, so let's not worry about that. On the first digit, a borrow needs to be made. This subtracts 1 from the 3 in the tens place and adds 10 to the 8 in the ones place, allowing us to perform the digit subtraction. However, since each digit is stored in a nibble (which can represent the range 0-15), the current implementation breaks horribly on any subtraction of this nature.