Until the first stable release, updated documentation is posted only on GitHub wiki.

This library aims to provide a simple API for solving mathematical expressions. These must be specified in a string using Infix notation. Internally the code uses an AST-based algorithm to calculate the result. This project includes a command line utility named xeval.

Consuming The Code
  • Source Inclusion. The project is entirely written in C# and is also thought to be included in another (C#) project.
  • DLL Referencing. Anyway you can reference the library as binary DLL file, consuming it from any .NET language.

Library Usage
It follows a basic sample:
using ExpressionEngine;
// ...
string infix = "21 + ((-3 * .4) + pow(3, 2) * sqrt(301))";
Expression expression = Expression.Create(infix);
try {
  double result = expression.Value; //175,944164156077
} catch (ExpressionException e) {
  Console.WriteLine("LINE {0}; ERR: {1}", e.ColumnNumber, e.Message);
}

Notes
Please remember that is an earlier Beta version. Public API can change until the release of more advanced betas or release candidates; use it in production level software at your own risk (of rewriting some code that consumes public types).

Last edited Jan 3, 2013 at 5:53 PM by gsscoder, version 15

Comments

No comments yet.