Fixing VBSCRIPT inaccurate mathematical results due to rounding
        Posted  
        
            by jay
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by jay
        
        
        
        Published on 2010-03-29T04:08:21Z
        Indexed on 
            2010/03/29
            4:53 UTC
        
        
        Read the original article
        Hit count: 532
        
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?
© Stack Overflow or respective owner