Пример #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();
            }
        }
Пример #2
0
 public static LuryObject Mul(LuryObject self, LuryObject other)
 {
     if (other.LuryTypeName == IntrinsicInteger.FullName)
     {
         return(GetObject((double)self.Value * (double)(BigInteger)other.Value));
     }
     else if (other.LuryTypeName == FullName)
     {
         return(GetObject((double)self.Value * (double)other.Value));
     }
     else if (other.LuryTypeName == IntrinsicComplex.FullName)
     {
         return(IntrinsicComplex.GetObject((double)self.Value * (Complex)other.Value));
     }
     else
     {
         throw new ArgumentException();
     }
 }