public static object ReverseMod(BigInteger x, object other) { if (other is int) { return(IntOps.Mod((int)other, x)); } if (other is Complex64) { Complex64 y = (Complex64)other; if (y.IsZero) { throw Ops.ZeroDivisionError(); } return(ComplexOps.Mod(y, Complex64.MakeReal(x))); } if (other is double) { return(FloatOps.Mod((double)other, x)); } if (other is bool) { return(Mod((bool)other ? 1 : 0, x)); } if (other is long) { return(Mod((long)other, x)); } if (other is BigInteger) { return(Mod((BigInteger)other, x)); } if (other is ExtensibleInt) { return(Mod(((ExtensibleInt)other).value, x)); } if (other is ExtensibleComplex) { Complex64 y = ((ExtensibleComplex)other).value; if (y.IsZero) { throw Ops.ZeroDivisionError(); } return(ComplexOps.Mod(y, Complex64.MakeReal(x))); } if (other is byte) { return(IntOps.Mod((int)((byte)other), x)); } if (other is ExtensibleFloat) { return(FloatOps.Mod(((ExtensibleFloat)other).value, x)); } return(Ops.NotImplemented); }
public static object Mod(bool x, object other) { if (other is bool) { return(IntOps.Mod(x ? 1 : 0, (bool)other ? 1 : 0)); } else { return(IntOps.Mod(x ? 1 : 0, other)); } }