public static double coerceValueToDouble(ValueEval ev) throws EvaluationException {if (ev == BlankEval.instance) {return 0.0;}if (ev instanceof NumericValueEval) {return ((NumericValueEval)ev).getNumberValue();}if (ev instanceof StringEval) {String sval = ((StringEval) ev).getStringValue();Double dd = parseDouble(sval);if(dd == null) dd = parseDateTime(sval);if (dd == null) {throw EvaluationException.invalidValue();}return dd.doubleValue();}throw new RuntimeException("Unexpected arg eval type (" + ev.getClass().getName() + ")");}

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 + ")");}
