8

Math.Round(8.075, 2, MidpointRounding.AwayFromZero) returns 8.07, though it should return 8.08. Mysteriously enough, 7.075 is working fine, but 9.075 also returns 9.07!

What to do? Does anybody know a rounding method without such bugs?

4

3 に答える 3

-2

可能な解決策は次のとおりです。

(double)Math.Round((decimal)8.075, 2, MidpointRounding.AwayFromZero);
于 2016-09-08T06:54:42.233 に答える