System.Globalization.CCMath.div_mod C# (CSharp) Method

div_mod() public static method

A static method that combines integer division and remainder computation.
public static div_mod ( int &remainder, int x, int y ) : int
remainder int Remainder integer output value. ///
x int Integer to be divided.
y int Divisor integer value.
return int
	public static int div_mod(out int remainder, int x, int y) {
		int d = div(x, y);
		remainder = x - y * d;
		return d;
	}

Usage Example

Example #1
0
        public static int year_from_fixed(int date)
        {
            int x    = date - 1;
            int num  = CCMath.div_mod(out x, x, 146097);
            int num2 = CCMath.div_mod(out x, x, 36524);
            int num3 = CCMath.div_mod(out x, x, 1461);
            int num4 = CCMath.div(x, 365);
            int num5 = 400 * num + 100 * num2 + 4 * num3 + num4;

            return((num2 != 4 && num4 != 4) ? (num5 + 1) : num5);
        }
All Usage Examples Of System.Globalization.CCMath::div_mod