Here's the direct port of the Excel function for a variable number of decimal places
public double RoundDown(double number, int decimalPlaces)
{
return Math.Floor(number * Math.Pow(10, decimalPlaces)) / Math.Pow(10, decimalPlaces);
}
eg. RoundDown (13.608000,2) = 13.60, RoundDown (12345, -3) = 12000,
source
share