![]() |
|
||||
Money Multiplication |
|||||
PROBLEMA narrow range of money multiplications result in a money value that has one dollar than it should, and 100 pennies more than it should. Nearly all of the money math will treat this value correctly, but if it is compared to a different money amount that has the same value but the regular dollar and penny amounts, then Goldenseal will think they are different. Caught ByTurtle Creek testing. It turned up when we were fiddling with negative multipliers and price updating in estimates. WorkaroundThe number of cases where this will be a visible problem is extremely limited, which is why it took us so long to notice the problem. Odds are good that nobody has ever noticed this problem, and never will. SolutionFixed in Goldenseal 3.2. Technical DetailsTo be technical, Goldenseal stores the dollar amount as a signed 32-bit number. One bit marks an "overflow" value, which leaves 30 bits for the actual dollar value-- or up to $2,000,000,000 (two billion).We store the penny amount as a signed 16 bit number. That allows four decimal places (down to 1/100 penny) which is useful for unit costing, tax rates and a few other cases.Percentage and number values use the same format, they just don't get a currency sign.For currencies outside the US and Canada, there is
room for up to 2 billion of the "large" currency unit
(pounds, francs, marks, krona, pesetas, pesos etc).
There is room for four decimal places in the "small"
currency unit (pence, pfennigs, ore, centavos etc). We assume that
there are 100 small units in a large unit, which seems
to apply to all current currencies that we've ever heard
about. |