Microsoft.Scripting.Utils.MathUtils.FloorRemainder C# (CSharp) Method

FloorRemainder() public static method

Calculates the remainder of floor division of two 32-bit signed integers.
is 0.
public static FloorRemainder ( int x, int y ) : int
x int Dividend.
y int Divisor.
return int
        public static int FloorRemainder(int x, int y) {
            if (y == -1) return 0;
            int r = x % y;

            if (x >= 0) {
                if (y > 0) {
                    return r;
                } else if (r == 0) {
                    return 0;
                } else {
                    return r + y;
                }
            } else {
                if (y > 0) {
                    if (r == 0) {
                        return 0;
                    } else {
                        return r + y;
                    }
                } else {
                    return r;
                }
            }
        }

Same methods

MathUtils::FloorRemainder ( long x, long y ) : long