This is probably a silly question, but maybe it isn’t, so I’ll ask.
I have a program, and am working with currencies. When I do an interest calculation, you know the ever popular
I = P * R * T
I use a floating type, so I don’t wind up with a rounding error. However, when I do the calculation, and add or subtract it, depending on what I am doing, I would wind up with anywhere from 0.05 cents to 0.16 cents difference in what calculating with only a dollars and two cent value after the decimal.
Should I be doing a calculation with some OTHER type to get a closer to accurate calculation? I can FORMAT the number when I am using it, but I don’t do this when I am actually doing the calculation, as I want accuracy.
Any ideas? Or is this just the nature of the beast?