I would like to achieve the following Code example so I can store the formula into database and reuse it:
Function fun = new Function("(${x}+${y})/${z}");
Argument x = new Argument("x", BigDecimal.ValueOf("1.1"));
Argument y = new Argument("y", BigDecimal.ValueOf("1.1"));
Argument z = new Argument("y", BigDecimal.ValueOf("1.1"));
BigDecimal result = fun.calculate(x,y,z);
I have already tried other frameworks like commons-jexl
and mathparser
, but none of them support BigDecimal
.