One piece of information that you might already be aware of, but is important if you are not, is that division by integers will always equal integers even if the result is stored in a double.
More often that not, when I think I have a rounding problem it is because of this.
Here is an...