1 9 package org.nfunk.jep.function; 10 11 import java.util.*; 12 import org.nfunk.jep.*; 13 import org.nfunk.jep.type.*; 14 15 21 public class ArcSineH extends PostfixMathCommand 22 { 23 public ArcSineH() 24 { 25 numberOfParameters = 1; 26 } 27 28 public void run(Stack inStack) 29 throws ParseException 30 { 31 checkStack(inStack); Object param = inStack.pop(); 33 inStack.push(asinh(param)); return; 35 } 36 37 public Object asinh(Object param) 38 throws ParseException 39 { 40 if (param instanceof Complex) 41 { 42 return ((Complex)param).asinh(); 43 } 44 else if (param instanceof Number ) 45 { 46 double val = ((Number )param).doubleValue(); 47 double res = Math.log(val+Math.sqrt(val*val+1)); 48 return new Double (res); 49 } 52 throw new ParseException("Invalid parameter type"); 53 } 54 } 55 | Popular Tags |