in reply to subtraction not working right
This is classic floating point rounding/truncation symptom. The two values are calculated in different ways so end up being rounded/truncated differently and become very slightly different values. You could fix it by storing cents rather than dollars (integers rather than floats).
|
|---|