Download parser-125.hqx (119,276 KB)
From: iano@cco.caltech.edu
Subject: Parser 1.2.5
The Mathematical Expression Parser (a C++ library with full source code
and stand alone test app) can parse numerical expressions or functions
such as "sqrt( sin( 1.2e-3) - 2*y)", containing variables with arbitrary
names. It is written with function plotters, spreadsheets and curve
fitters in mind -- programs that need to very quickly evaluate the same
function many times, changing the values of variables in between.
Evaluation speeds are typically 30-90% as fast as directly compiled code.
(The included test application allows you to check this claim for
yourself.) Thus, this is among the fastest parsers available, yet safe
since it checks for error conditions such as division by zero before
conducting these operations.
Supports: +, -, *, /, %, ^ (power), -(unary), !, &&, ||, ==, !=, <=, >=,
<. >, ?: (for piecewise continuous functions), &, |, !& (XOR), ~, exp, ln,
log, abs, sqrt, ceil, floor, rand, sin, cos, tan, sec, csc, cot, asin,
acos, atan, asec, acsc, acot, sinh, cosh, tanh, sech, csch, coth, and the
following predefined constants: e, pi, true and false. Variables may have
any name and are not limited in number. Parenthesis are handled to
arbitrary depths. The library also does symbolic math and can take partial
derivatives. You can scrap the numerical methods and use this library to
directly evaluate derivatives at near compiled speeds! All calculations
(except bitwise operations) are done with double precision floating point
math. The included project file requires CW Pro 5, but the code base
should compile on pretty much anything on any system.
This code base is shareware, but is free for deployment in freeware
applications.
Enjoy,
Ian Ollmann
iano@cco.caltech.edu