Take the 2-minute tour ×

As the title suggests I need a C# equivelant of ROUNDDOWN.

For example, if you take the figure 13.608000, the output i am looking for is 13.60.

I can't seem to find anything that covers exactly what I am after.

share|improve this question

6 Answers 6

up vote 6 down vote accepted

You could do the following:

var rounded = Math.Floor(13.608000 * 100) / 100;

Note that Math.Floor() rounds down to the nearest integer, hence the need to multiply, round down, and then divide.

share|improve this answer

Here's a direct port of the Excel function for variable number of decimal places

public double RoundDown(double number, int decimalPlaces)
    return Math.Floor(number * Math.Pow(10, decimalPlaces)) / Math.Pow(10, decimalPlaces);

e.g. RoundDown (13.608000,2) = 13.60, RoundDown(12345,-3) = 12000,

share|improve this answer
This works GREAT!!! –  B-Rad Nov 20 '12 at 22:53

Here's the right solution:

    double RoundDown(double value, int digits)
        if (value >= 0)
            return Math.Floor(value * Math.Pow(10, digits)) / Math.Pow(10, digits);

        return Math.Ceiling(value * Math.Pow(10, digits)) / Math.Pow(10, digits);

RichardW1001's answer is almost right, he just didn't account for the rounding of negative values.

share|improve this answer
This does not work in the same way as RoundDown in Excel which seems to round -ve values up towards zero e.g. -2.55 becomes -2, this function will round -2.55 to -3. –  Pones Oct 7 '13 at 10:56

For rounding down, use Math.Floor. To round off to a different factor than 1.0, multiply before calling Floor and divide afterwards.

double x = 0.01 * Math.Floor(100 * y);
share|improve this answer

Math.Round function should do it, http://msdn.microsoft.com/en-us/library/zy06z30k.aspx

share|improve this answer
<quote>The behavior of this method follows IEEE Standard 754, section 4. This kind of rounding is sometimes called rounding to nearest</quote> Question asked about rounding down. –  Ben Voigt Nov 19 '10 at 23:47
Not quite, because it does not always round down. –  BoltClock Nov 19 '10 at 23:47
That is true. I misread the 8 in the question for a zero. –  Jason Nov 19 '10 at 23:49


decimal x = 13.6080001;
int places = 2;
int result = (int)(Math.Round(x - (0.5 * Math.Pow(10, 0 - places), places)));
share|improve this answer

Your Answer


