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 SineH extends PostfixMathCommand 17 { 18 public SineH() 19 { 20 numberOfParameters = 1; 21 } 22 23 public void run(Stack inStack) 24 throws ParseException 25 { 26 checkStack(inStack); Object param = inStack.pop(); 28 inStack.push(sinh(param)); return; 30 } 31 32 public Object sinh(Object param) 33 throws ParseException 34 { 35 if (param instanceof Complex) 36 { 37 return ((Complex)param).sinh(); 38 } 39 else if (param instanceof Number ) 40 { 41 double value = ((Number )param).doubleValue(); 42 return new Double ((Math.exp(value)-Math.exp(-value))/2); 43 } 44 45 throw new ParseException("Invalid parameter type"); 46 } 47 48 } 49 | Popular Tags |