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++

以上就是How does Excel successfully round floating point numbers even though they are imprecise?的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » excel

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

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

支付宝扫一扫打赏

微信扫一扫打赏