Java Mathematic expression evaluator
June 9, 2008
For a program I’m working on these days I found this very useful library for evaluating mathematic expression.
Its name is meval. I found really little discussion about it on the net, despite it seemed very good to me. Of course, it’s a KISS library
Here’s how to use it:
import com.primalworld.math.MathEvaluator;
...
MathEvaluator m = new MathEvaluator("-5-6/(-2) + sqr(15+x)");
m.addVariable("x", 15.1d);
System.out.println( m.getValue() );
That’s all. Pretty easy, pretty good! A new great tool on my KISS Java bag!
Entry Filed under: development, java, mission, opensource. .

Trackback this post | Subscribe to the comments via RSS Feed