first commit
This commit is contained in:
28
hrmsEjb/org/nfunk/jep/function/ArcCosineH.java
Normal file
28
hrmsEjb/org/nfunk/jep/function/ArcCosineH.java
Normal file
@@ -0,0 +1,28 @@
|
||||
package org.nfunk.jep.function;
|
||||
|
||||
import java.util.Stack;
|
||||
import org.nfunk.jep.ParseException;
|
||||
import org.nfunk.jep.type.Complex;
|
||||
|
||||
public class ArcCosineH extends PostfixMathCommand {
|
||||
public void run(Stack paramStack) throws ParseException {
|
||||
checkStack(paramStack);
|
||||
Object object = paramStack.pop();
|
||||
paramStack.push(acosh(object));
|
||||
}
|
||||
|
||||
public Object acosh(Object paramObject) throws ParseException {
|
||||
if (paramObject instanceof Complex)
|
||||
return ((Complex)paramObject).acosh();
|
||||
if (paramObject instanceof Number) {
|
||||
double d = ((Number)paramObject).doubleValue();
|
||||
if (d >= 1.0D) {
|
||||
double d1 = Math.log(d + Math.sqrt(d * d - 1.0D));
|
||||
return new Double(d1);
|
||||
}
|
||||
Complex complex = new Complex(((Number)paramObject).doubleValue(), 0.0D);
|
||||
return complex.acosh();
|
||||
}
|
||||
throw new ParseException("Invalid parameter type");
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user