Esempio n. 1
0
  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;
    }
  }
Esempio n. 2
0
 public final void run(DoubleStack stack) {
   stack.push(Math.abs(stack.pop()));
 }
Esempio n. 3
0
 public final void run(DoubleStack inStack) throws ParseException {
   inStack.push(Math.random());
 }
Esempio n. 4
0
    public final void run(DoubleStack inStack) throws ParseException {
      double param2 = inStack.pop();
      double param1 = inStack.pop();

      inStack.push(Math.pow(param1, param2));
    }
Esempio n. 5
0
 public final void run(DoubleStack stack) throws ParseException {
   stack.push(Math.sqrt(stack.pop()));
 }
Esempio n. 6
0
 public final double operation(double[] params) throws ParseException {
   return Math.tan(params[0]);
 }
Esempio n. 7
0
 public final double operation(double[] params) throws ParseException {
   return Math.log(params[0]) / LOG_10;
 }