imaginary number in jscl

This commit is contained in:
Sergey Solovyev 2011-11-21 15:11:36 +04:00
parent 57309170e8
commit ce96e028a9
2 changed files with 6 additions and 9 deletions

View File

@ -34,14 +34,11 @@ class FromJsclNumericTextProcessor implements TextProcessor<String> {
}
} catch (NumberFormatException e) {
result = result.replace(MathType.INFINITY_JSCL, MathType.INFINITY);
if (result.contains(MathType.IMAGINARY_NUMBER_JSCL)) {
try {
result = createResultForComplexNumber(result.replace(MathType.IMAGINARY_NUMBER_JSCL, MathType.IMAGINARY_NUMBER));
} catch (NumberFormatException e1) {
// throw original one
throw new ParseException(e);
}
try {
result = createResultForComplexNumber(result.replace(MathType.IMAGINARY_NUMBER_JSCL, MathType.IMAGINARY_NUMBER));
} catch (NumberFormatException e1) {
// throw original one
throw new ParseException(e);
}
}

View File

@ -130,7 +130,7 @@ public class CalculatorEngineTest {
} catch (ParseException e) {
}
try {
junit.framework.Assert.assertEquals("i", cm.evaluate(JsclOperation.numeric, "π/π!").getResult());
junit.framework.Assert.assertEquals("1", cm.evaluate(JsclOperation.numeric, "π/π!").getResult());
fail();
} catch (ParseException e) {
}