1 9 package org.nfunk.jep.function; 10 11 import java.lang.Math ; 12 import java.util.*; 13 import org.nfunk.jep.*; 14 import org.nfunk.jep.type.*; 15 16 public class ArcSine extends PostfixMathCommand 17 { 18 public ArcSine() 19 { 20 numberOfParameters = 1; 21 22 } 23 24 public void run(Stack inStack) 25 throws ParseException 26 { 27 checkStack(inStack); Object param = inStack.pop(); 29 inStack.push(asin(param)); return; 31 } 32 33 public Object asin(Object param) 34 throws ParseException 35 { 36 if (param instanceof Complex) 37 { 38 return ((Complex)param).asin(); 39 } 40 else if (param instanceof Number ) 41 { 42 return new Double (Math.asin(((Number )param).doubleValue())); 43 } 44 45 throw new ParseException("Invalid parameter type"); 46 } 47 48 } 49 | Popular Tags |