diff --git a/calculatorpp/src/main/java/org/solovyev/android/calculator/CalculatorModel.java b/calculatorpp/src/main/java/org/solovyev/android/calculator/CalculatorModel.java index 805ea1fd..53c5a224 100644 --- a/calculatorpp/src/main/java/org/solovyev/android/calculator/CalculatorModel.java +++ b/calculatorpp/src/main/java/org/solovyev/android/calculator/CalculatorModel.java @@ -199,6 +199,7 @@ public enum CalculatorModel implements CursorControl, HistoryControl 0) { - if (localNb.charAt(localNb.length() - 1) == MathType.POWER_10) { - return true; - } - } - } - return false; + if (!isHexMode()) { + if ("-".equals(mathTypeResult.getMatch()) || "+".equals(mathTypeResult.getMatch())) { + final StringBuilder localNb = numberBuilder; + if (localNb != null && localNb.length() > 0) { + if (localNb.charAt(localNb.length() - 1) == MathType.POWER_10) { + return true; + } + } + } + } + return false; } public boolean isHexMode() { diff --git a/calculatorpp/src/main/java/org/solovyev/android/calculator/model/NumberBuilder.java b/calculatorpp/src/main/java/org/solovyev/android/calculator/model/NumberBuilder.java index 807996ea..effc0005 100644 --- a/calculatorpp/src/main/java/org/solovyev/android/calculator/model/NumberBuilder.java +++ b/calculatorpp/src/main/java/org/solovyev/android/calculator/model/NumberBuilder.java @@ -9,14 +9,11 @@ package org.solovyev.android.calculator.model; import jscl.MathContext; import jscl.MathEngine; import jscl.NumeralBase; -import jscl.math.function.IConstant; import jscl.math.numeric.Real; import jscl.text.*; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.solovyev.android.calculator.math.MathType; -import org.solovyev.common.utils.CollectionsUtils; -import org.solovyev.common.utils.Finder; import org.solovyev.common.utils.MutableObject; import java.util.ArrayList; diff --git a/calculatorpp/src/test/java/org/solovyev/android/calculator/TextHighlighterTest.java b/calculatorpp/src/test/java/org/solovyev/android/calculator/TextHighlighterTest.java index 0f0739cf..bc8950a9 100644 --- a/calculatorpp/src/test/java/org/solovyev/android/calculator/TextHighlighterTest.java +++ b/calculatorpp/src/test/java/org/solovyev/android/calculator/TextHighlighterTest.java @@ -98,6 +98,7 @@ public class TextHighlighterTest { me.setNumeralBase(NumeralBase.hex); Assert.assertEquals("E", textHighlighter.process("E").toString()); Assert.assertEquals(".E", textHighlighter.process(".E").toString()); + Assert.assertEquals("E+", textHighlighter.process("E+").toString()); Assert.assertEquals("E.", textHighlighter.process("E.").toString()); Assert.assertEquals(".E.", textHighlighter.process(".E.").toString()); Assert.assertEquals("6F", textHighlighter.process("6F").toString());