text: public static double CoerceValueToDouble(ValueEval ev){if (ev == BlankEval.instance){return 0.0;}if (ev is NumericValueEval){return ((NumericValueEval)ev).NumberValue;}if (ev is StringEval){double dd = ParseDouble(((StringEval)ev).StringValue);if (double.IsNaN(dd)){throw EvaluationException.InvalidValue();}return dd;}throw new Exception("Unexpected arg eval type (" + ev.GetType().Name + ")");}