calcr is a small calculator that interprets text as a mathematical expression, supporting basic operators (+
,-
,*
,/
) and variable substitution.
float result = Calcr.parseFloat("1 + x", "x", 42); // result = 43
Or use multiple variables
Map<String, Float> variables = new HashMap<String, Float>();
variables.put("x", 42f);
variables.put("y", 7f);
float result = Calcr.parseFloat("x / y", variables); // result = 6
git clone git://github.com/platzhaltr/calcr.git
cd calcr
mvn clean install
- exp4j Math expression evaluator with support for all
Math
operators functions and the possibility to create new ones.