Ejemplo n.º 1
0
        public static LuryObject Pow(LuryObject self, LuryObject other)
        {
            if (other.LuryTypeName == FullName)
            {
                var exponent = (BigInteger)other.Value;

                if (exponent > int.MaxValue || exponent < int.MinValue)
                {
                    return(IntrinsicReal.GetObject(Math.Pow((double)(BigInteger)self.Value, (double)exponent)));
                }
                else
                {
                    return(GetObject(BigInteger.Pow((BigInteger)self.Value, (int)exponent)));
                }
            }
            else if (other.LuryTypeName == IntrinsicReal.FullName)
            {
                return(IntrinsicReal.GetObject(Math.Pow((double)(BigInteger)self.Value, (double)other.Value)));
            }
            else if (other.LuryTypeName == IntrinsicComplex.FullName)
            {
                return(IntrinsicComplex.GetObject(Complex.Pow((double)(BigInteger)self.Value, (Complex)other.Value)));
            }
            else
            {
                throw new ArgumentException();
            }
        }
Ejemplo n.º 2
0
 public static LuryObject Mod(LuryObject self, LuryObject other)
 {
     if (other.LuryTypeName == FullName)
     {
         return(GetObject((BigInteger)self.Value % (BigInteger)other.Value));
     }
     else if (other.LuryTypeName == IntrinsicReal.FullName)
     {
         return(IntrinsicReal.GetObject((double)(BigInteger)self.Value % (double)other.Value));
     }
     // if (other.LuryTypeName == IntrinsicComplex.FullName)
     else
     {
         throw new ArgumentException();
     }
 }