public NumericValue Exp(NumericValue exponentVal) { exponentVal.VerifyNoUnits("Exponent cannot have units."); if (!exponentVal.IsInteger) { VerifyNoUnits("Base can only have units for positive integer exponents."); return new NumericValue(Math.Pow(GetFloat, exponentVal.GetFloat)); } var exponent = exponentVal.IntValue; object result; if ((exponent >= 0) && (IsInteger)) result = BigInteger.Pow(GetInteger, exponent); else result = Math.Pow(GetFloat, exponent); return new NumericValue(result, Units ^ exponent); }
public NumericValue ShiftRight(NumericValue val2) { val2.VerifyNoUnits(); return new NumericValue(GetInteger >> val2.IntValue, Units); }