static NumericalValue times(NumericalValue p1, NumericalValue p2) { return new NumericalValue(p1.AsDecimal() * p2.AsDecimal()); }
static NumericalValue plus(NumericalValue p1, NumericalValue p2) { return new NumericalValue(p1.AsDecimal() + p2.AsDecimal()); }
static NumericalValue power(NumericalValue p1, NumericalValue p2) { return new NumericalValue((decimal)Math.Pow((double)p1.AsDecimal(), (double)p2.AsDecimal())); //TODO: Handle all overflow exceptions //TODO: Catch overflow exceptions //Get a mathematics library that can do computations without overflow or divide by zero //Report to UI or save the value without evaluating }
static NumericalValue dividedBy(NumericalValue p1, NumericalValue p2) { return new NumericalValue(p1.AsDecimal() / p2.AsDecimal()); }