• Stars
    star
    110
  • Rank 306,765 (Top 7 %)
  • Language
    C#
  • License
    Other
  • Created about 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

Handle database errors easily when working with Entity Framework Core. Supports SQLServer, PostgreSQL, SQLite, Oracle and MySql.
C#
1,109
star
2

LINQPad.QueryPlanVisualizer

SQL Server and PostgreSQL query execution plan visualizer for LINQPad
C#
389
star
3

EFCore.Visualizer

Entity Framework Core queries debugger visualizer.
C#
367
star
4

DuckDB.NET

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

GraphQLinq

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

BetterOpenWith

A better way to open files
Java
36
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

U2G-Shipping-Calculator

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

VpnProxyChanger

Automatically launches rdp to work PC and sets proxy
C#
3
star
13

EF-Core-Demos

EF Core Examples
C#
3
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

Okta.CaloriesTracker

JavaScript
1
star
20

SE-Hot-Network-Questions-Filter

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

PostgresRangeTypes

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

github-stats

Python
1
star