MathLib - Extending the core functionality

By default, JBEE only knows it's operators and a basic set of safe to call functions (safe to call in the sense that they may fail, but will never compute a result with precision loss). The core functionality can be enhanced by either implementing the MathLib interface or extending the DefaultMathLib class and passing an instance to the Evaluator like this:

MathLib myLib = new MyLib();
DecimalFormat df = (DecimalFormat)DecimalFormat.getInstance();
Evaluator e = new Evaluator(df, myLib);

The MathLib interface is a very powerful concept, allowing for hooking into nearly every part of the parsing process. Care should be taken when implementing it. In most cases (such as when only new functions are needed), it is usually a better idea to extend the DefaultMathLib interface instead.