I'm building a calculator app which take up math expressions, parses it and displays the results, for that I use Javaluator.
Something like:
String expression = "(2^3-1)";
Double result = new DoubleEvaluator().evaluate(expression);
I use two textView for this: one for displaying user input (expression) and the other for displaying the results which are a Double.
Everything works fine but I would like to get rid of the float that is returned after each operation: e.g: 10 * 10 = 100.0
. I tried something like finResult = result.intValue();
works but is broken for division operations. e.g: 2 / 3 = 0
.
Is there a way to fix that?