sqrt + log10 + ln
This commit is contained in:
@@ -33,18 +33,17 @@ public class Functions {
|
||||
public final static String ATANH = "atanh";
|
||||
|
||||
public final static String LN = "ln";
|
||||
public final static String LN_JSCL = "log";
|
||||
public final static String LOG = "log";
|
||||
|
||||
public final static String MOD = "mod";
|
||||
public final static String EXP = "exp";
|
||||
|
||||
public final static String SQRT = "√";
|
||||
public final static String SQRT_JSCL = "sqrt";
|
||||
|
||||
public static final List<String> allPrefix;
|
||||
|
||||
static {
|
||||
final List<String> functions = new ArrayList<String>(Arrays.asList(SIN, SINH, ASIN, ASINH, COS, COSH, ACOS, ACOSH, TAN, TANH, ATAN, ATANH, LN, LN_JSCL, MOD, SQRT, SQRT_JSCL, EXP));
|
||||
final List<String> functions = new ArrayList<String>(Arrays.asList(SIN, SINH, ASIN, ASINH, COS, COSH, ACOS, ACOSH, TAN, TANH, ATAN, ATANH, LN, LOG, MOD, SQRT, EXP));
|
||||
Collections.sort(functions, new MathEntityComparator());
|
||||
allPrefix = functions;
|
||||
}
|
||||
|
@@ -129,37 +129,7 @@ public enum MathType {
|
||||
}
|
||||
},
|
||||
|
||||
function(1000, true, true, Functions.allPrefix) {
|
||||
@Override
|
||||
protected String getSubstituteToJscl(@NotNull String match) {
|
||||
final String result;
|
||||
|
||||
if (match.equals(Functions.LN)) {
|
||||
result = Functions.LN_JSCL;
|
||||
} else if (match.equals(Functions.SQRT)) {
|
||||
result = Functions.SQRT_JSCL;
|
||||
} else {
|
||||
result = null;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getSubstituteFromJscl(@NotNull String match) {
|
||||
final String result;
|
||||
|
||||
if (match.equals(Functions.LN_JSCL)) {
|
||||
result = Functions.LN;
|
||||
} else if (match.equals(Functions.SQRT_JSCL)) {
|
||||
result = Functions.SQRT;
|
||||
} else {
|
||||
result = null;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
},
|
||||
function(1000, true, true, Functions.allPrefix),
|
||||
|
||||
constant(1100, true, true) {
|
||||
@NotNull
|
||||
@@ -317,7 +287,7 @@ public enum MathType {
|
||||
public final static String POWER_10_JSCL = "10^";
|
||||
|
||||
public static final String IMAGINARY_NUMBER = "i";
|
||||
public static final String IMAGINARY_NUMBER_JSCL = "sqrt(-1)";
|
||||
public static final String IMAGINARY_NUMBER_JSCL = "√(-1)";
|
||||
|
||||
public static final String PI = "π";
|
||||
public static final String E = "e";
|
||||
|
@@ -79,7 +79,7 @@ public enum CalculatorEngine {
|
||||
private ThreadKiller threadKiller = new AndroidThreadKiller();
|
||||
|
||||
// calculation thread timeout in milliseconds, after timeout thread would be interrupted
|
||||
private int timeout = 2000;
|
||||
private int timeout = 3000;
|
||||
|
||||
@NotNull
|
||||
public String format(@NotNull Double value) {
|
||||
|
Reference in New Issue
Block a user