1 9 10 package org.nfunk.jep.function; 11 12 import java.lang.Math ; 13 import java.util.*; 14 import org.nfunk.jep.*; 15 16 20 public class ArcTangent2 extends PostfixMathCommand 21 { 22 public ArcTangent2() 23 { 24 numberOfParameters = 2; 25 } 26 27 public void run(Stack inStack) 28 throws ParseException 29 { 30 checkStack(inStack); Object param2 = inStack.pop(); 32 Object param1 = inStack.pop(); 33 34 if ((param1 instanceof Number ) && (param2 instanceof Number )) 35 { 36 double y = ((Number )param1).doubleValue(); 37 double x = ((Number )param2).doubleValue(); 38 inStack.push(new Double (Math.atan2(y, x))); } 40 else 41 throw new ParseException("Invalid parameter type"); 42 return; 43 } 44 } 45 | Popular Tags |