fix floating point approximation error
Merge pull request #2871 from jw2013/floating-point

fix floating point approximation error