pitermarx / ncalc2 Goto Github PK
View Code? Open in Web Editor NEWClone of NCalc, ported to netstandard2.0
License: MIT License
Clone of NCalc, ported to netstandard2.0
License: MIT License
Any chance you can update this to use the latest .NET 4.6?
As discussed in pitermarx/NCalc-Edge#14, when using circular references, the Evaluate method leads to a StackOverflowException (which is not catchable).
For user written expressions, this is a blocking problem.
For example :
NCalc.Expression exp = new NCalc.Expression("RefCroise1");
exp.Parameters["RefCroise1"] = new NCalc.Expression("RefCroise2 * 5");
exp.Parameters["RefCroise2"] = new NCalc.Expression("RefCroise1 * 12");
object result = exp.Evaluate(); // Causes stack overflow
.hasErrors() neither detects it.
I think this is a major error to be detected, as this is crashing the program.
Nota : I did not check how it is in NCalc2 but as @pitermarx asked, I'm creating the PR here.
Thanks.
var maxInt = Int32.MaxValue;
var overflow = new Expression(maxInt + "+1").Evaluate();
The engine rightly assumes an integer number as an Int32 but this leads to overflow.
Investigate a way to have explicit cast to long.
I'm looking at submitting a pull request for some small improvements with larger data calculations. Would this repo or your NCalc-Edge have a higher chance of a newer Nuget package being release?
Hi
Is there a way to disable TraceInformation logging? We are using logging in our app and the logs are getting spammed by NCalc logs, for example Trace.TraceInformation in Expression.cs.
Thanks
I'm evaluating expressions with some highly dynamic, unknown-at-runtime data. Say integer values are passed for x and y in the following expression:
x = 5 or y = 'foo'
Ideally, if x is 5 I'd like this to evaluate to true. But in the case where y is an integer, the entire expression fails with a FormatException
. If y is null, it fails with a NullReferenceException
. Both are thrown from EvaluationVisitor.CompareUsingMostPreciseType.
I'm not sure if evaluating to false in those cases instead throwing exceptions is necessarily more correct. Maybe a better approach would be to provide hooks into those comparisons to allow that behavior to be customized.
Generally speaking, would you consider this project active? I searched hard for a good .NET expression parsing engine and none seem to be very active from what I've seen. (I'm actually using the original NCalc, but your forks are much newer so I figured you might be more open to further development.) If a new fork would be the way to go, or me taking over this one, I would gladly entertain the idea. Our company is investing fairly heavily in a new rules engine of which this could be an important component. I'd be glad to keep it alive and moving forward. Alternatively, if you'd consider a pull request, I could do that too.
Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.