imaginary number in jscl
This commit is contained in:
parent
455236a6a3
commit
f1930c913a
@ -34,15 +34,12 @@ class FromJsclNumericTextProcessor implements TextProcessor<String> {
|
|||||||
}
|
}
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
result = result.replace(MathType.INFINITY_JSCL, MathType.INFINITY);
|
result = result.replace(MathType.INFINITY_JSCL, MathType.INFINITY);
|
||||||
if (result.contains(MathType.IMAGINARY_NUMBER_JSCL)) {
|
|
||||||
try {
|
try {
|
||||||
result = createResultForComplexNumber(result.replace(MathType.IMAGINARY_NUMBER_JSCL, MathType.IMAGINARY_NUMBER));
|
result = createResultForComplexNumber(result.replace(MathType.IMAGINARY_NUMBER_JSCL, MathType.IMAGINARY_NUMBER));
|
||||||
} catch (NumberFormatException e1) {
|
} catch (NumberFormatException e1) {
|
||||||
// throw original one
|
// throw original one
|
||||||
throw new ParseException(e);
|
throw new ParseException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -130,7 +130,7 @@ public class CalculatorEngineTest {
|
|||||||
} catch (ParseException e) {
|
} catch (ParseException e) {
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
junit.framework.Assert.assertEquals("i", cm.evaluate(JsclOperation.numeric, "π/π!").getResult());
|
junit.framework.Assert.assertEquals("1", cm.evaluate(JsclOperation.numeric, "π/π!").getResult());
|
||||||
fail();
|
fail();
|
||||||
} catch (ParseException e) {
|
} catch (ParseException e) {
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user