Recently I ran into an interesting problem on a small project I was working on. The problem was on the surface fairly simple. Take a currency amount and round it up to the nearest 0.05. While the solution is not earth shattering it took long enough to figure out that I figured it was worth recording for my future self. The first part of the problem is to round to 0.05 which is accomplished by doing this (thanks Google..): decimal initialValue = 0.56;
decimal value = Math.Round(initialValue / 5, 2) * 5;
But the problem is this code...