How To Start

To start using the library, simply import the jar to your classpath.
Next you will have to obtain Calculator object, by calling factory method:

Calculator.createDefaultCalculator();

The only public method for the calculator is calculate(String). The method's parameter is string containing arithmetic expression. Method returns BigDecimal object.

Supported operations are:
+
-
*
/
^ (power)
And functions:
sin
cos
tg
ctg

example of use:
given the equation:

2^3*(12/6)+18/3+5.0/2

we have:

Calculator calc = Calculator.createDefaultCalculator();
BigDecimal result = calc.calculate("2^3*(12/6)+18/3+5.0/2");

Please fill free to use, extend, and correct this library.


Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.