public static object ReverseFloorDivide(BigInteger x, object other)
 {
     if (other is int)
     {
         return(IntOps.Divide((int)other, x));
     }
     if (other is Complex64)
     {
         Complex64 y = (Complex64)other;
         if (y.IsZero)
         {
             throw Ops.ZeroDivisionError();
         }
         return(ComplexOps.Divide(y, Complex64.MakeReal(x)));
     }
     if (other is double)
     {
         return(FloatOps.FloorDivide((double)other, x));
     }
     if (other is bool)
     {
         return(Divide((bool)other ? 1 : 0, x));
     }
     if (other is long)
     {
         return(Divide((long)other, x));
     }
     if (other is BigInteger)
     {
         return(Divide((BigInteger)other, x));
     }
     if (other is ExtensibleInt)
     {
         return(Divide(((ExtensibleInt)other).value, x));
     }
     if (other is ExtensibleComplex)
     {
         Complex64 y = ((ExtensibleComplex)other).value;
         if (y.IsZero)
         {
             throw Ops.ZeroDivisionError();
         }
         return(ComplexOps.FloorDivide(y, Complex64.MakeReal(x)));
     }
     if (other is byte)
     {
         return(IntOps.Divide((int)((byte)other), x));
     }
     if (other is ExtensibleFloat)
     {
         return(FloatOps.FloorDivide(((ExtensibleFloat)other).value, x));
     }
     return(Ops.NotImplemented);
 }
        public static object Divide(long x, object other)
        {
            if (other is int)
            {
                int y = (int)other;
                try {
                    return(Ops.Long2Object(Divide(x, y)));
                } catch (OverflowException) {
                    return(BigInteger.Create(x) / y);
                }
            }
            else if (other is BigInteger)
            {
                return(LongOps.Divide(BigInteger.Create(x), (BigInteger)other));
            }
            else if (other is double)
            {
                return(FloatOps.Divide(x, (double)other));
            }
            else if (other is Complex64)
            {
                return(ComplexOps.Divide(Complex64.MakeReal(x), (Complex64)other));
            }
            else if (other is bool)
            {
                int y = (bool)other ? 1 : 0;
                try {
                    return(Ops.Long2Object(Divide(x, y)));
                } catch (OverflowException) {
                    return(BigInteger.Create(x) / y);
                }
            }
            else if (other is long)
            {
                long y = (long)other;
                try {
                    return(Divide(x, y));
                } catch (OverflowException) {
                    return(BigInteger.Create(x) / y);
                }
            }
            else if (other is float)
            {
                return(FloatOps.Divide(x, (float)other));
            }
            else if (other is ExtensibleInt)
            {
                int y = ((ExtensibleInt)other).value;
                try {
                    return(Ops.Long2Object(Divide(x, y)));
                } catch (OverflowException) {
                    return(BigInteger.Create(x) / y);
                }
            }
            else if (other is ExtensibleFloat)
            {
                return(FloatOps.Divide(x, ((ExtensibleFloat)other).value));
            }
            else if (other is ExtensibleComplex)
            {
                return(ComplexOps.Divide(Complex64.MakeReal(x), ((ExtensibleComplex)other).value));
            }
            else if (other is byte)
            {
                int y = (int)((byte)other);
                try {
                    return(Ops.Long2Object(Divide(x, y)));
                } catch (OverflowException) {
                    return(BigInteger.Create(x) / y);
                }
            }

            return(Ops.NotImplemented);
        }
 public static object Divide(int x, object other)
 {
     if (other is int)
     {
         int y = (int)other;
         try {
             return(Ops.Int2Object(Divide(x, y)));
         } catch (OverflowException) {
             return(LongOps.Divide(BigInteger.Create(x), y));
         }
     }
     else if (other is BigInteger)
     {
         return(LongOps.Divide(BigInteger.Create(x), (BigInteger)other));
     }
     else if (other is double)
     {
         return(FloatOps.Divide(x, (double)other));
     }
     else if (other is Complex64)
     {
         Complex64 y = (Complex64)other;
         if (y.IsZero)
         {
             throw Ops.ZeroDivisionError();
         }
         return(ComplexOps.Divide(Complex64.MakeReal(x), y));
     }
     else if (other is bool)
     {
         bool b = (bool)other;
         return(x / (b ? 1 : 0));
     }
     else if (other is long)
     {
         long y = (long)other;
         try {
             return(Divide(x, y));
         } catch (OverflowException) {
             return(LongOps.Divide(BigInteger.Create(x), y));
         }
     }
     else if (other is float)
     {
         return(FloatOps.Divide(x, (float)other));
     }
     else if (other is byte)
     {
         return(Ops.Int2Object(Divide(x, (int)((byte)other))));
     }
     else if (other is ExtensibleInt)
     {
         int y = ((ExtensibleInt)other).value;
         try {
             return(Ops.Int2Object(Divide(x, y)));
         } catch (OverflowException) {
             return(LongOps.Divide(BigInteger.Create(x), y));
         }
     }
     else if (other is ExtensibleFloat)
     {
         return(FloatOps.Divide(x, ((ExtensibleFloat)other).value));
     }
     else if (other is ExtensibleComplex)
     {
         Complex64 y = ((ExtensibleComplex)other).value;
         if (y.IsZero)
         {
             throw Ops.ZeroDivisionError();
         }
         return(ComplexOps.Divide(Complex64.MakeReal(x), y));
     }
     return(Ops.NotImplemented);
 }