-
-
Notifications
You must be signed in to change notification settings - Fork 364
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parameter name does not support operators #301
Comments
I think this is not supported and it is out of scope for the project. We try to follow the same rules of C#, where |
Thank you for your suggestion. Actually, due to my usage scenario, I need to perform calculations based on parameters, like this var interpreter = new Interpreter();
var formula = "P1-X * (P2-Y + P3-Z)";
var parameters = new[]
{
new Parameter("P1-X", 24),
new Parameter("P2-Y", 10),
new Parameter("P3-Z", 10)
};
var result = interpreter.Eval<double>(formula, parameters); In the end, I chose to wrap my parameters in {} and replace them with the corresponding data to implement it var interpreter = new Interpreter();
var formula = "{P1-X} * ({P2-Y} + {P3-Z})";
var result = interpreter.Eval<double>(ConvertHelper(formula)); //"24 * (10 + 10)" |
Is there any way to handle situations where parameter names contain operators?
This code cannot obtain the correct result.
The text was updated successfully, but these errors were encountered: