diff --git a/symja_android_library/matheclipse-core/src/main/java/org/matheclipse/core/expression/AbstractAST.java b/symja_android_library/matheclipse-core/src/main/java/org/matheclipse/core/expression/AbstractAST.java index d95feaa13..da968f6ee 100644 --- a/symja_android_library/matheclipse-core/src/main/java/org/matheclipse/core/expression/AbstractAST.java +++ b/symja_android_library/matheclipse-core/src/main/java/org/matheclipse/core/expression/AbstractAST.java @@ -1616,13 +1616,13 @@ public boolean compareAdjacent(BiPredicate predicate) { */ @Override public int compareTo(final IExpr rhsExpr) { + if (rhsExpr.isNumber()) { + // O-7 + return 1; + } final int lhsOrdinal = headID(); int rhsOrdinal = -1; if (lhsOrdinal < 0) { - if (rhsExpr.isNumber()) { - // O-7 - return 1; - } rhsOrdinal = rhsExpr.headID(); if (rhsOrdinal < 0) { if (rhsExpr.isAST()) { @@ -1634,19 +1634,11 @@ public int compareTo(final IExpr rhsExpr) { } } else { if (lhsOrdinal == ID.DirectedInfinity && isDirectedInfinity()) { - if (rhsExpr.isNumber()) { - // O-7 - return 1; - } if (!rhsExpr.isDirectedInfinity()) { return -1; } return compareToASTIncreasing(this, (IAST) rhsExpr); } - if (rhsExpr.isNumber()) { - // O-7 - return 1; - } rhsOrdinal = rhsExpr.headID(); } if (rhsExpr.isAST()) { @@ -5463,7 +5455,7 @@ public IExpr opposite() { } return rest(); } - return setAtCopy(1, ((INumber) arg1).negate()); + return setAtCopy(1, arg1.negate()); } IASTAppendable timesAST = copyAppendable(); timesAST.append(1, F.CN1);