package org.nfunk.jep.function;

import java.util.Stack;
import org.nfunk.jep.ParseException;

public class ArcTangent2 extends PostfixMathCommand {
  public void run(Stack paramStack) throws ParseException {
    checkStack(paramStack);
    Number number1 = (Number)paramStack.pop();
    Number number2 = (Number)paramStack.pop();
    if (number2 instanceof Number && number1 instanceof Number) {
      double d1 = ((Number)number2).doubleValue();
      double d2 = ((Number)number1).doubleValue();
      paramStack.push(new Double(Math.atan2(d1, d2)));
    } else {
      throw new ParseException("Invalid parameter type");
    } 
  }
}
