• Stars
    star
    114
  • Rank 308,031 (Top 7 %)
  • Language
    C#
  • License
    Other
  • Created over 12 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A C# library for parsing mathemitical expressions with support for parentheses and variables.

Math Expression Evaluator NuGet Version

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));

Installation

PM> Install-Package Math-Expression-Evaluator 

More Repositories

1

EntityFramework.Exceptions

Strongly typed exceptions for Entity Framework Core. Supports SQLServer, PostgreSQL, SQLite, Oracle and MySql.
C#
1,446
star
2

EFCore.Visualizer

Entity Framework Core queries debugger visualizer.
C#
419
star
3

LINQPad.QueryPlanVisualizer

SQL Server and PostgreSQL query execution plan visualizer for LINQPad
C#
399
star
4

DuckDB.NET

Bindings and ADO.NET Provider for DuckDB
C#
392
star
5

GraphQLinq

LINQ to GraphQL - Strongly typed GraphQL queries with LINQ query syntax. No more magic strings and runtime errors.
C#
202
star
6

BetterOpenWith

A better way to open files
Java
42
star
7

Dynamic-PInvoke

C#
15
star
8

Entity-Framework-Analyzers

Code Analyzers and Fixers for Common Entity Framework Issues.
C#
9
star
9

Maui-DotNetConf-Sample

Maui Spatial Data Sample App
C#
7
star
10

Dynamic-ViewState-in-ASP.Net-WebForms

A sample project showing how to access ViewState data dynamically by using DynamicObject class
ASP.NET
6
star
11

VpnProxyChanger

Automatically launches rdp to work PC and sets proxy
C#
4
star
12

EF-Core-Demos

EF Core Examples
C#
4
star
13

U2G-Shipping-Calculator

Google Chrome extension for calculating USA2Georgia shipping cost on amazon.com
JavaScript
4
star
14

Silverlight-Remote-Control

Silverlight 4 application with remote control support.
C#
3
star
15

Giorgi

3
star
16

TbilisiFloodDonations

Visualization of Tbilisi flood donations
HTML
3
star
17

Movie-Explorer

C#
2
star
18

userscripts

Collection of userscripts for different websites
2
star
19

SemanticKernel.Connectors.Oracle

Semantic Kernel memory built on top of Oracle 23ai
C#
2
star
20

Okta.CaloriesTracker

JavaScript
1
star
21

SE-Hot-Network-Questions-Filter

Greasemonkey & Tampermonkey script for filterting hot network questions on stackexchange sites
JavaScript
1
star
22

PostgresRangeTypes

Demo showing how to use PostgreSQL ranges from Entity Framework Core
C#
1
star
23

github-stats

Python
1
star
24

DuckDB.NET-Docs

DuckDB.NET project documentation.
C#
1
star
25

Semantic-Search-Demo

Demo app for pgvector semantic search
C#
1
star