first commit

This commit is contained in:
2025-07-28 13:56:49 +05:30
commit e9eb805edb
3438 changed files with 520990 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
package org.nfunk.jep.function;
import java.util.Stack;
import org.nfunk.jep.ParseException;
import org.nfunk.jep.type.Complex;
public class Exp extends PostfixMathCommand {
public void run(Stack paramStack) throws ParseException {
checkStack(paramStack);
Object object = paramStack.pop();
paramStack.push(exp(object));
}
public Object exp(Object paramObject) throws ParseException {
if (paramObject instanceof Complex) {
Complex complex = (Complex)paramObject;
double d1 = complex.re();
double d2 = complex.im();
double d3 = Math.exp(d1);
return new Complex(d3 * Math.cos(d2), d3 * Math.sin(d2));
}
if (paramObject instanceof Number)
return new Double(Math.exp(((Number)paramObject).doubleValue()));
throw new ParseException("Invalid parameter type");
}
}