
Product
Introducing Scala and Kotlin Support in Socket
Socket now supports Scala and Kotlin, bringing AI-powered threat detection to JVM projects with easy manifest generation and fast, accurate scans.
Math-Expression-Evaluator
Advanced tools
A C# library for parsing mathematical expressions with support for parentheses and variables.
Entity Framework Extensions and Dapper Plus are major sponsors and are proud to contribute to the development of Math Expression Evaluator.
Math Expression Evaluator is a library for evaluating simple mathematical expressions. It supports simple expressions such as 2.5+5.9
, 17.89-2.47+7.16
, 5/2/2+1.5*3+4.58
, expressions with parentheses (((9-6/2)*2-4)/2-6-1)/(2+24/(2+4))
and expressions with variables:
var a = 6;
var b = 4.32m;
var c = 24.15m;
Assert.That(engine.Evaluate("(((9-a/2)*2-b)/2-a-1)/(2+c/(2+4))", new { a, b, c}),
Is.EqualTo((((9 - a / 2) * 2 - b) / 2 - a - 1) / (2 + c / (2 + 4))));
It is also possible to specify variables by using named arguments like this:
dynamic dynamicEngine = new ExpressionEvaluator();
var a = 6;
var b = 4.5m;
var c = 2.6m;
Assert.That(dynamicEngine.Evaluate("(c+b)*a", a: 6, b: 4.5, c: 2.6),
Is.EqualTo((c + b) * a));
dotnet add package Math-Expression-Evaluator
From https://stackoverflow.com/questions/50722680/methods-for-dynamically-creating-an-array-in-c-sharp
DavidG
Can't decide if this library is evil, genius or evil genius...
xanatos
That library is using high level magic... Very high level :-)
The class is dynamic and is handling in a dynamic way the use of the method... fascinating
FAQs
A C# library for parsing mathematical expressions with support for parentheses and variables.
We found that math-expression-evaluator demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports Scala and Kotlin, bringing AI-powered threat detection to JVM projects with easy manifest generation and fast, accurate scans.
Application Security
/Security News
Socket CEO Feross Aboukhadijeh and a16z partner Joel de la Garza discuss vibe coding, AI-driven software development, and how the rise of LLMs, despite their risks, still points toward a more secure and innovative future.
Research
/Security News
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.