In most locations and with most currencies, the calculation of what amount should be sent in the Create Bucket Transaction action is very straightforward — it is just the minor currency units to the right of the decimal place of the change that would otherwise be due to the customer.

However, there could be locations where this is not the case. When the lowest bill denomination is greater than a single currency unit, the amount that would be bucketed is the modulo (or remainder after division) of the change due and the lowest bill denomination (E.g. 7.20 mod 2 = 1.20).

Even still there are locations where this simple calculation would be problematic where *the second lowest bill denomination is not evenly divisible by the lowest bill denomination*.

Take the case of a location with currency X where the highest coin denomination is 1X and the lowest two bill denominations are 2X and 5X.

In this case, the intended effect of having Bucket remove coins from the transaction is not achieved by simply bucketing all minor currency units right of the decimal point since it would lead to customers getting a 1X coin half of the time.

Using the above example and applying the [Change Due] mod [Lowest Bill Denomination] logic, a transaction where 6.20X is due back before bucketing would yield a .20X bucketed amount and instruct the cashier to hand the customer 6X, which would either lead to the cashier unnaturally giving the customer 3 2X bills or a 5X bill and a 1X coin, defeating the spirit of the product.

In this case the solution is to apply the Natural Change Function, which describes the way that a human being makes change. The calculation would in that case be to iterate through every bill denomination lower than the amount due back, starting with the highest and proceeding in descending order, performing the modulo function on the results.

Using the example of 6.20X due back, the bucketed amount would be: (6.20X mod 5) mod 2 = 1.20X and the customer would get a single 5X bill back.