Closed jwr456 closed 4 years ago
Never mind, I figured this out:
Eval.Execute("someOtherDouble*Math.Pow(1.5,2)", this);
works
Hello @jwr456 ,
I will re-open it as I believe we have an issue here and your initial code should have worked.
Best Regards,
Jon
In fact, that's currently working.
The issue is that you create an instance context and specify options to it but you don't use it. You use instead the global context which doesn't have the option and which the ^
operator behaves like the one in C#
var context = new EvalContext() { UseCache = false };
context.UseCaretForExponent = true;
var x1 = context.Execute("3.1*(1.5^2.0)", this);
EvalManager.DefaultContext.UseCaretForExponent = true;
var x1 = Eval.Execute("3.1*(1.5^2.0)", this);
I am using the following:
and getting the following exception
Operator '^' cannot be applied to operands of type 'double' and 'double'
when I try to Eval this
Eval.Execute("someOtherDouble*(1.5^2.0)", this);
and this Operator '^' cannot be applied to operands of type 'double' and 'int'
when I try to Eval this
Eval.Execute("someOtherDouble*(1.5^2)", this);
Can the Eval-Expression.NET not do exponents on doubles or am I doing something incorrectly?
Thanks,
Joel