Quantcast
Channel: NCalc - Mathematical Expressions Evaluator for .NET
Viewing all articles
Browse latest Browse all 58

New Post: Casting to double fails

$
0
0
The code sample in the first post of this thread will also fail, even after your suggested 'fix', if instead of "2" you use "3.5" (for example).

i.e.
string formel = "x+3.5";
Expression e = new Expression(formel);
e.Parameters["x"] = 2.5;

var result = (decimal) e.Evaluate();

will fail with "Operator '+' can't be applied to operands of types 'decimal' and 'double'"

https://ncalc.codeplex.com/discussions/528933

Viewing all articles
Browse latest Browse all 58

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>