Fixing VB6 inaccurate mathmetical results due to rounding
- by jay
Try running this in a .VBS file
MsgBox(545.14-544.94)
You get a neat little answer of 0.199999999999932!
This rounding issue also occurs unfortunately in Sin(2 * pi) since VB can only ever see the (user defined) variable pi as accurate as 3.14159265358979.
Is rounding it manually (and loosing accuracy) the only way to improve the result? What is the most effective way of dealing with this kind of problem?