uto,
It seems like you want a floor function. There is nothing like this in
..NET which can do this for you, but it is easy enough to program.
public static double Floor(double value)
{
// Just return the overload.
return Floor(value, 0);
}
public static double Floor(double value, int digits)
{
// Check here to see if digits is negative.
// Get the amount to subtract from value. Generally, if you are
rounding
// to 0 places, then you would subtract .5, and round normally. If to
// 1 place, then subtract .05, etc, etc.
int powerOfTen = Math.Pow(10, digits);
// Now subtract, and round.
return Math.Round(value - (.5 * powerOfTen), digits);
}
Hope this helps.