25 lines
756 B
Java
25 lines
756 B
Java
package org.nfunk.jep.function;
|
|
|
|
import java.util.Stack;
|
|
import org.nfunk.jep.ParseException;
|
|
import org.nfunk.jep.type.Complex;
|
|
|
|
public class ArcSineH extends PostfixMathCommand {
|
|
public void run(Stack paramStack) throws ParseException {
|
|
checkStack(paramStack);
|
|
Object object = paramStack.pop();
|
|
paramStack.push(asinh(object));
|
|
}
|
|
|
|
public Object asinh(Object paramObject) throws ParseException {
|
|
if (paramObject instanceof Complex)
|
|
return ((Complex)paramObject).asinh();
|
|
if (paramObject instanceof Number) {
|
|
double d1 = ((Number)paramObject).doubleValue();
|
|
double d2 = Math.log(d1 + Math.sqrt(d1 * d1 + 1.0D));
|
|
return new Double(d2);
|
|
}
|
|
throw new ParseException("Invalid parameter type");
|
|
}
|
|
}
|