 |
|
 |
I think you mean to check if style == NumberStyles.Number instead of NumberStyles.Integer (since you checked for Integer in the previous conditional evaluation).
|
|
|
|
 |
|
 |
Thank you for your effort.
I offer to change small part of it for international use
string num = sb.ToString();
if (style == NumberStyles.Integer) {
int ivalue;
if (int.TryParse(num, out ivalue))
return ivalue;
long lvalue;
if (long.TryParse(num, out lvalue))
return lvalue;
return decimal.Parse(num, CultureInfo.InvariantCulture.NumberFormat);
}
if (style == NumberStyles.Integer)
return double.Parse(num, CultureInfo.InvariantCulture.NumberFormat);
return float.Parse(num, CultureInfo.InvariantCulture.NumberFormat);
|
|
|
|
 |
|
 |
Hi,
Thanks, it works great.
I.e. It should be part ofthe framework.
Chen.
|
|
|
|
 |
|
 |
This is much needed an quiet simple! Thanks!
|
|
|
|
 |
|
 |
Hi there, great work, I'm using your code and trying to make it better, it's very usefull thanks a lot
|
|
|
|
 |
|
 |
If I enter 1000000/0.001 the result is 9.999999E08 as opposed to 1000000000.0. Any ideas on how to fix this rounding problem?
|
|
|
|
 |
|
 |
If I enter 5*-2 it gives an exception "Value does not fall within the expected range.".
Works fine the other way round -2*5.
Any ideas on how to fix this?
|
|
|
|
 |
|
|
 |
|
 |
Congrats on the great work!!
|
|
|
|
 |
|
 |
This code has hundreds of bugs. You can't eval moderate to complex expressions.
If you were planning to use this for work, forget it; use it only for academic purposes.
-- Daniel
|
|
|
|
 |
|
 |
I understand that this evaluator uses reflection, but would we have any way to automatically treat any numerical expression as a decimal operation (e.g., "2/5" returns 0.4 instead of 0)?
|
|
|
|
 |
|
 |
I know for each individual case, we can change the expression (i.e. "2/5" becomes "2.0/5"), but I'm wondering if this has a parsing setting or the like.
|
|
|
|
 |
|
 |
Is it possible to buy license from you for using your code in commercial product? How can I contact you if yes? Thank you.
|
|
|
|
 |
|
 |
it is absolutely free to use
|
|
|
|
 |
|
 |
'Evaluater' should be 'Evaluator', otherwise everything is working great. I'll be testing things further but so far this is fantastic, thanks for the contribution!
|
|
|
|
 |
|
 |
Hi,
When you enter a line:
"3+1*0"; // gives result=3 , which is OK!!
"3+1*0*0"; // gives result=0 , which is wrong!!
I think that there is something wrong in the priority list. Note: "*" and "/" (multiplication and division) should have higher priority than "+" and "-"!
Further, I recommend that the TestExpr program is updated with code like the following for adding variables:
Dictionary<string,> DCALCULATION = new Dictionary<string,>();
DCALCULATION.Add("aaa", 2);
DCALCULATION.Add("bbb", 3);
DCALCULATION.Add("ccc", 4);
DCALCULATION.Add("ddd", -0.0D);
foreach (KeyValuePair<string,> kvp in DCALCULATION)
{
pvh.Parameters[kvp.Key] = new Parameter(typeof(double));
pvh.Parameters[kvp.Key].Value = kvp.Value;
}
And further, the TestExpr could be expanded to verify the calculation.
Regards,Pauf
|
|
|
|
 |
|
 |
Hello!
I'm trying to use the library to create new Performance Counters based in the existing one's.
I want to know how is possible know the list of variables of a expression and after assign a value?
It is possible to add new functions? For example to calculate the average
How works the parent and member functions?
There is any manual?
Thank you in advance
|
|
|
|
 |
|
 |
Hi,
Thank you for your great code
Chen
|
|
|
|
 |
|
 |
Great Work. thanks
but i try it ,and can't parse like:
2+(3)4
|
|
|
|
 |
|
 |
Hi,
What do you mean by saying 2+(3)4 the expression is invalid
Chen
|
|
|
|
 |
|
 |
Hi, nice work!
is it possible to add a variable not through the ParameterVariableHolder ?
I want to do something like that -
a=2
b=a+3
Math.Pow(a, b)
thanks ..
|
|
|
|
 |
|
 |
I really like the work you have done. Very nice job!
I am trying to get it to return a value from a nested object hierarchy:
oData.Request.ScenarioCollection(0).FinanceCollection(0).FinanceData.FinanceTerms.DaysPerYear
The code tries to return a value from the "oData.Request" and does not continue to follow the node trail.
Is it possible to do what I am trying to do with your code?
Thanks
|
|
|
|
 |
|
 |
Hi
This looks like a nice piece of work!
I could not find any information regarding license type. Do you have any restrictions on the use of the code, or is it free to use without restrictions?
/K
|
|
|
|
 |
|
|
 |
|
 |
Nice work,
You can try alternative solution:
Script.NET - a language for embedding scripting functionality into .NET applications.
http://www.protsyk.com/scriptdotnet ,
http://www.codeproject.com/useritems/ScriptNET.asp
|
|
|
|
 |