@Test public void testCreateResultForComplexNumber() throws Exception { final FromJsclNumericTextProcessor cm = new FromJsclNumericTextProcessor(); final JsclMathEngine me = JsclMathEngine.getInstance(); me.setGroupingSeparator(' '); final AngleUnit defaultAngleUnits = me.getAngleUnits(); assertEquals("1.22133+23 123i", cm.process(Expression.valueOf("1.22133232+23123*i").numeric())); assertEquals("1.22133+1.2i", cm.process(Expression.valueOf("1.22133232+1.2*i").numeric())); assertEquals("1.22133+0i", cm.process(Expression.valueOf("1.22133232+0.000000001*i").numeric())); try { me.setAngleUnits(AngleUnit.rad); assertEquals("1-0i", cm.process(Expression.valueOf("-(e^(i*π))").numeric())); } finally { me.setAngleUnits(defaultAngleUnits); } assertEquals("1.22i", cm.process(Expression.valueOf("1.22*i").numeric())); assertEquals("i", cm.process(Expression.valueOf("i").numeric())); Generic numeric = Expression.valueOf("e^(Π*i)+1").numeric(); assertEquals("0i", cm.process(numeric)); }
@Nonnull @Override public String process(@Nonnull Generic numeric) { return numeric.toString().replace("*", ""); }
FromJsclNumericTextProcessor implements TextProcessor<String, Generic> { @Nonnull @Override public String process(@Nonnull Generic numeric) { return numeric.toString().replace("*", ""); } }
FromJsclNumericTextProcessor implements TextProcessor<String, Generic> { @Nonnull @Override public String process(@Nonnull Generic numeric) { return numeric.toString().replace("*", ""); }  }
FromJsclNumericTextProcessor implements TextProcessor<String, Generic> { @Nonnull @Override public String process(@Nonnull Generic numeric) { return numeric.toString().replace("*", ""); }  @Nonnull @Override String process(@Nonnull Generic numeric); }
FromJsclNumericTextProcessor implements TextProcessor<String, Generic> { @Nonnull @Override public String process(@Nonnull Generic numeric) { return numeric.toString().replace("*", ""); }  @Nonnull @Override String process(@Nonnull Generic numeric); static final FromJsclNumericTextProcessor instance; }