package org.nfunk.jep.function;

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

public class ArcCosine extends PostfixMathCommand {
  public void run(Stack paramStack) throws ParseException {
    checkStack(paramStack);
    Object object = paramStack.pop();
    paramStack.push(acos(object));
  }
  
  public Object acos(Object paramObject) throws ParseException {
    if (paramObject instanceof Complex)
      return ((Complex)paramObject).acos(); 
    if (paramObject instanceof Number)
      return new Double(Math.acos(((Number)paramObject).doubleValue())); 
    throw new ParseException("Invalid parameter type");
  }
}
