Open ramakrishnareddy2108 opened 4 years ago
sqrt takes a double as an argument, but it should convert for you. I created a test and it passes without issue, so provide code/expression if this is still an issue:
ExpressionContext context = new ExpressionContext();
context.Imports.AddType(typeof(Math));
IDynamicExpression e1 = context.CompileDynamic("sqrt(16)");
Assert.AreEqual(4.0, e1.Evaluate());
Following code will return Flee.PublicTypes.ExpressionCompileException: 'FunctionCallElement: Could find not function 'sqrt(Decimal)''
ExpressionContext context = new ExpressionContext();
context.Imports.AddType(typeof(Math));
context.Variables["a"] = Convert.ToDecimal(199);
IDynamicExpression eDynamic = context.CompileDynamic("sqrt(a) + pi");
var result = eDynamic.Evaluate();
Odd, it passes on my system.
getting 'FunctionCallElement: Could find not function 'sqrt(Int32)'' error while using sqrt math operator