Closed cuiliang closed 4 years ago
Hello @cuiliang ,
Sure, that's possible, you are currently looking for the DefaultNumberType
option.
EvalManager.DefaultContext.DefaultNumberType = DefaultNumberType.Double;
var result = Eval.Execute("5/3");
Console.WriteLine(result); // 1.66666666666667
https://dotnetfiddle.net/JgQGqJ
Obviously, it could have a side impact as a method expecting an int
is no longer compatible if there is no double overload.
Let me know if that answers your question correctly.
Best Regards,
Jon
Yes, thank you. did not see this in document, perhaps it should be updated. https://eval-expression.net/options
Is there any option that can make expression "5 / 3" result to 1.6666667? I want to evaluate user-inputed expression to let them compute some numbers, they don't know what is integer what is double.