static class Logarithm extends PostfixMathCommand { public Logarithm() { numberOfParameters = 1; } private static final double LOG_10 = Math.log(10); public final double operation(double[] params) throws ParseException { return Math.log(params[0]) / LOG_10; } }
public final void run(DoubleStack stack) { stack.push(Math.abs(stack.pop())); }
public final void run(DoubleStack inStack) throws ParseException { inStack.push(Math.random()); }
public final void run(DoubleStack inStack) throws ParseException { double param2 = inStack.pop(); double param1 = inStack.pop(); inStack.push(Math.pow(param1, param2)); }
public final void run(DoubleStack stack) throws ParseException { stack.push(Math.sqrt(stack.pop())); }
public final double operation(double[] params) throws ParseException { return Math.tan(params[0]); }
public final double operation(double[] params) throws ParseException { return Math.log(params[0]) / LOG_10; }