# How does Excel successfully round floating point numbers even though they are imprecise?

For example, [this blog](http://blogs.office.com/b/microsoft-excel/archive/2008/04/10/understanding-floating-point-precision-aka-why-does-excel-give-me-seemingly-wrong-answers.aspx) says 0.005 is not exactly 0.005, but rounding that number yields the right result. I have tried all kinds of rounding in C++ and it fails when rounding numbers to certain decimal places. For example, Round(x,y) rounds x to a multiple of y. So Round(37.785,0.01) should give you 37.79 and not 37.78. I am reopening this question to ask the community for help. The problem is with the impreciseness of floating point numbers (37,785 is represented as 37.78499999999). The question is how does Excel get around this problem? The solution in this https://stackoverflow.com/questions/485525/round-for-float-in-c is incorrect for the above problem.
possible duplicate of round() for float in C++

### 觉得文章有用就打赏一下文章作者

#### 支付宝扫一扫打赏 #### 微信扫一扫打赏 