diff --git a/pom.xml b/pom.xml
index 51aebdc2..5732e6ad 100644
--- a/pom.xml
+++ b/pom.xml
@@ -65,6 +65,15 @@
+
+ achartengine
+ achartengine
+ 0.7.0
+ system
+ ${additionalLibs}/achartengine-0.7.0.jar
+
+
+
com.intellij
annotations
diff --git a/src/main/java/org/solovyev/android/calculator/model/CalculatorEngine.java b/src/main/java/org/solovyev/android/calculator/model/CalculatorEngine.java
index 97bb1925..06dd60cd 100644
--- a/src/main/java/org/solovyev/android/calculator/model/CalculatorEngine.java
+++ b/src/main/java/org/solovyev/android/calculator/model/CalculatorEngine.java
@@ -188,6 +188,9 @@ public enum CalculatorEngine {
} catch (ArithmeticException e) {
//System.out.println(e.getMessage());
exception.setObject(new ParseException(e.getMessage(), e));
+ } catch (StackOverflowError e) {
+ //System.out.println(StringUtils.fromStackTrace(e.getStackTrace()));
+ exception.setObject(new ParseException(e.getMessage(), e));
} catch (jscl.text.ParseException e) {
//System.out.println(e.getMessage());
exception.setObject(new ParseException(e.getMessage(), e));
diff --git a/src/misc/src/achartengine-0.7.0.jar b/src/misc/src/achartengine-0.7.0.jar
new file mode 100644
index 00000000..aec45ffc
Binary files /dev/null and b/src/misc/src/achartengine-0.7.0.jar differ
diff --git a/src/test/java/org/solovyev/android/calculator/model/CalculatorEngineTest.java b/src/test/java/org/solovyev/android/calculator/model/CalculatorEngineTest.java
index dc081551..b928e64a 100644
--- a/src/test/java/org/solovyev/android/calculator/model/CalculatorEngineTest.java
+++ b/src/test/java/org/solovyev/android/calculator/model/CalculatorEngineTest.java
@@ -157,12 +157,7 @@ public class CalculatorEngineTest {
Assert.assertEquals("3.957", cm.evaluate(JsclOperation.numeric, "ln(8)lg(8)+ln(8)").getResult());
Assert.assertEquals("0", cm.evaluate(JsclOperation.numeric, "((((((0))))))").getResult());
- try {
- Assert.assertEquals("0", cm.evaluate(JsclOperation.numeric, "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((0))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))").getResult());
- fail();
- } catch (ParseException e) {
- // ok
- }
+ Assert.assertEquals("0", cm.evaluate(JsclOperation.numeric, "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((0))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))").getResult());
/* Assert.assertEquals("0.524", cm.evaluate(JsclOperation.numeric, "30°").getResult());
@@ -232,11 +227,7 @@ public class CalculatorEngineTest {
} catch (ParseException e) {
}
- try {
- Assert.assertEquals("0.739", cm.evaluate(JsclOperation.numeric, "cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(1))))))))))))))))))))))))))))))))))))").getResult());
- Assert.fail();
- } catch (ParseException e) {
- }
+ Assert.assertEquals("0.739", cm.evaluate(JsclOperation.numeric, "cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(cos(1))))))))))))))))))))))))))))))))))))").getResult());
CalculatorEngine.instance.getVarsRegister().add(new Var.Builder("si", 5d));
Assert.assertEquals("5", cm.evaluate(JsclOperation.numeric, "si").getResult());
@@ -312,10 +303,17 @@ public class CalculatorEngineTest {
} catch (ParseException e) {
}
+
Assert.assertEquals("0.017", cm.evaluate(JsclOperation.numeric, "1°").getResult());
Assert.assertEquals("0.349", cm.evaluate(JsclOperation.numeric, "20.0°").getResult());
Assert.assertEquals("0.5", cm.evaluate(JsclOperation.numeric, "sin(30°)").getResult());
Assert.assertEquals("0.524", cm.evaluate(JsclOperation.numeric, "asin(sin(30°))").getResult());
+ try {
+ Assert.assertEquals("∂(cos(t), t, t,1°)", cm.evaluate(JsclOperation.numeric, "∂(cos(t),t,t,1°)").getResult());
+ fail();
+ } catch (ParseException e) {
+ }
+ Assert.assertEquals("∂(cos(t), t, t,1°)", cm.evaluate(JsclOperation.simplify, "∂(cos(t),t,t,1°)").getResult());
}
}