예제 #1
0
        private SymbolicUnit consolidateComplex(SymbolicUnit newPower)
        {
            if (!IsNumber || !newPower.IsNumber)
            {
                return(new SymbolicUnit(_value, newPower));
            }

            if (IsInteger && newPower.IsInteger)
            {
                return(new SymbolicUnit((int)Math.Round(Math.Pow(AsInteger(), newPower.AsInteger()))));
            }
            return(new SymbolicUnit(Math.Pow(AsFloat(), newPower.AsFloat())));
        }
예제 #2
0
 private bool hasPower()
 {
     return(!(_power == null ||
              (_power.IsInteger && _power.AsInteger() == 1)));
 }