first commit
This commit is contained in:
28
hrmsEjb/org/nfunk/jep/function/ArcTanH.java
Normal file
28
hrmsEjb/org/nfunk/jep/function/ArcTanH.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 ArcTanH extends PostfixMathCommand {
|
||||
public void run(Stack paramStack) throws ParseException {
|
||||
checkStack(paramStack);
|
||||
Object object = paramStack.pop();
|
||||
paramStack.push(atanh(object));
|
||||
}
|
||||
|
||||
public Object atanh(Object paramObject) throws ParseException {
|
||||
if (paramObject instanceof Complex)
|
||||
return ((Complex)paramObject).atanh();
|
||||
if (paramObject instanceof Number) {
|
||||
double d = ((Number)paramObject).doubleValue();
|
||||
if (d > -1.0D && d < 1.0D) {
|
||||
double d1 = Math.log((1.0D + d) / (1.0D - d)) / 2.0D;
|
||||
return new Double(d1);
|
||||
}
|
||||
Complex complex = new Complex(d, 0.0D);
|
||||
return complex.atanh();
|
||||
}
|
||||
throw new ParseException("Invalid parameter type");
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user