CodePlexProject Hosting for Open Source Software

Nanocalc - Lightweight Scientific Calculator is a simple to use, easy to integrate and extremely efficient and fast mathematical expression parsing and evaluation engine. The parsing engine supports various kinds of functional, logic processing semantics and is very easily extendible.

http://partow.net/programming/nanocalc/index.html

Nanocalc has the following capabilities:

- Mathematical operators (+, -, *, /, %, ^)
- Functions (min, max, avg, sum, abs, ceil, floor, round, roundn, exp, log, log10, logn, root, sqrt, clamp, range, sgn)
- Trigonometry (sin, cos, tan, acos, asin, atan, atan2, cosh, cot, csc, sec, sinh, tanh, d2r, r2d, d2g, g2d, hyp)
- Equalities, Inequalities and Assigment (=, ==, <>, !=, <, <=, >, >=, :=, <-)
- Boolean logic, conditional statements and while-loop construct (and, or, xor, not, nand, nor, if-then-else, while)
- Optimization of expressions (constant folding, operator coupling and special functions for arithmetic sequences)
- Multiple and custom variable support
- Single header implementation, no building required. No external dependencies.
- Completely portable (Compiled and executed upon: x86 x86-64, ARMv7/8, POWER6/7 and AVR32)
- Extremely fast expression evaluation

- sqrt(1 - (x^2))
- clamp(-1,sin(2 * pi * x) + cos(y / 2 * pi),+1)
- sin(2 * x)
- if(((x + 2) == 3) and ((y + 5) <= 9),1 + w, 2 / z)
- inrange(-2,m,+2) == if(({-2 <= m} and [m <= +2]),1,0)
- ({1 / 1} * [1 / 2] + (1 / 3)) - {1 / 4} ^ [1 / 5] + (1 / 6) -({1 / 7} + [1 / 8]*(1 / 9))
- a * exp(2 * t) + c
- z := x + sin(2 * pi / y)
- u <- 2 * (pi * z) / (w := x + cos(y / pi))

Last edited May 6, 2012 at 9:18 AM by ArashPartow, version 2