downward Rounding - CSharp System

CSharp examples for System:Math

Description

downward Rounding

Demo Code

/*/*from  www . j a  v a  2 s.co  m*/
 *  CalendarConverter, part of project "Fourmilab Calendar Converter"
 *  Partial copyright by John Walker
 *  http://www.fourmilab.ch/documents/calendar/
 *  This program is in the public domain.
 *
 *  C# implementation:
 *  Copyright (C) 2011 by Sergey V. Zhdanovskih.
 *
 *  Additional methods for transformations:
 *  Copyright (C) 2016 by Ruslan Garipov.
 */
using System;

public class Main{
        protected static int downwardRounding(int dividend, int divisor)
        {
            if (0 <= dividend)
            {
                dividend /= divisor;
            }
            else
            {
                dividend = (int)(dividend / ((double) (divisor)) - 1.0);
            }
            return dividend;
        }
}

Related Tutorials