diff --git a/symja_android_library/matheclipse-core/src/main/java/org/matheclipse/core/builtin/BooleanFunctions.java b/symja_android_library/matheclipse-core/src/main/java/org/matheclipse/core/builtin/BooleanFunctions.java
index ecd65cbb91..93aa36a988 100644
--- a/symja_android_library/matheclipse-core/src/main/java/org/matheclipse/core/builtin/BooleanFunctions.java
+++ b/symja_android_library/matheclipse-core/src/main/java/org/matheclipse/core/builtin/BooleanFunctions.java
@@ -1734,11 +1734,6 @@ public IExpr evaluate(final IAST ast, EvalEngine engine) {
return S.Undefined;
}
- IAST evalArgs = engine.evalArgsN(ast, ISymbol.NOATTRIBUTE);
- if (evalArgs.isPresent()) {
- return evalArgs;
- }
-
if (ast.size() > 2) {
IExpr.COMPARE_TERNARY b = IExpr.COMPARE_TERNARY.UNDECIDABLE;
if (ast.isAST2()) {
@@ -2216,11 +2211,6 @@ public IExpr evaluate(IAST ast, EvalEngine engine) {
return S.True;
}
- IASTMutable evalArgs = engine.evalArgsN(ast, ISymbol.NOATTRIBUTE);
- if (evalArgs.isPresent()) {
- return evalArgs;
- }
-
IASTAppendable flattened;
if ((flattened = EvalAttributes.flattenDeep(ast)).isPresent()) {
ast = flattened;
@@ -4671,10 +4661,6 @@ private static final class Unequal extends Equal {
@Override
public IExpr evaluate(final IAST ast, EvalEngine engine) {
- IASTMutable evalArgs = engine.evalArgsN(ast, ISymbol.NOATTRIBUTE);
- if (evalArgs.isPresent()) {
- return evalArgs;
- }
if (ast.exists(x -> x.equals(S.Undefined))) {
return S.Undefined;
}
diff --git a/symja_android_library/matheclipse-core/src/main/java/org/matheclipse/core/builtin/GraphicsFunctions.java b/symja_android_library/matheclipse-core/src/main/java/org/matheclipse/core/builtin/GraphicsFunctions.java
index df4814f44d..f658c9f084 100644
--- a/symja_android_library/matheclipse-core/src/main/java/org/matheclipse/core/builtin/GraphicsFunctions.java
+++ b/symja_android_library/matheclipse-core/src/main/java/org/matheclipse/core/builtin/GraphicsFunctions.java
@@ -683,10 +683,6 @@ private static final class Labeled extends AbstractCoreFunctionEvaluator {
@Override
public IExpr evaluate(final IAST ast, EvalEngine engine) {
- IASTMutable evalArgs = engine.evalArgsN(ast, ISymbol.NOATTRIBUTE);
- if (evalArgs.isPresent()) {
- return evalArgs;
- }
return F.NIL;
}
diff --git a/symja_android_library/matheclipse-core/src/main/java/org/matheclipse/core/eval/EvalEngine.java b/symja_android_library/matheclipse-core/src/main/java/org/matheclipse/core/eval/EvalEngine.java
index 54dc139aae..a06c749eea 100644
--- a/symja_android_library/matheclipse-core/src/main/java/org/matheclipse/core/eval/EvalEngine.java
+++ b/symja_android_library/matheclipse-core/src/main/java/org/matheclipse/core/eval/EvalEngine.java
@@ -3,6 +3,7 @@
import java.io.PrintStream;
import java.io.Serializable;
import java.util.ArrayDeque;
+import java.util.Arrays;
import java.util.Deque;
import java.util.HashMap;
import java.util.IdentityHashMap;
@@ -826,22 +827,6 @@ public void evalArg(final IASTMutable[] result0, final IAST ast, final IExpr arg
}
- /**
- * Evaluate the arguments of the given ast
numerically, if {@link #isNumericMode()}
- * is true
taking the attributes
- * HoldFirst, NHoldFirst, HoldRest, NHoldRest, NumericFunction
into account.
- *
- * @param ast
- * @param attributes
- * @return F.NIL
is no evaluation was possible
- */
- public IASTMutable evalArgsN(final IAST ast, final int attributes) {
- if (isNumericMode()) {
- return evalArgs(ast, attributes, true);
- }
- return F.NIL;
- }
-
/**
* Evaluate the arguments of the given ast, taking the attributes
* HoldFirst, NHoldFirst, HoldRest, NHoldRest, NumericFunction
into account.
@@ -856,6 +841,9 @@ public IASTMutable evalArgs(final IAST ast, final int attributes, boolean numeri
final int astSize = ast.size();
if (astSize > 1) {
+ if (!numericFunction) {
+ numericFunction = isNumericArg(ast);
+ }
boolean numericMode = fNumericMode;
boolean localNumericMode = fNumericMode;
final boolean isNumericFunction;
@@ -956,6 +944,20 @@ public IASTMutable evalArgs(final IAST ast, final int attributes, boolean numeri
return F.NIL;
}
+ /**
+ * Test if the arguments of this ast
should be evaluated numerically in numeric mode.
+ *
+ * @param ast
+ * @return
+ */
+ private boolean isNumericArg(final IAST ast) {
+ int id = ast.headID();
+ if (id >= 0) {
+ return Arrays.binarySearch(F.SORTED_NUMERIC_ARGS_IDS, id) >= 0;
+ }
+ return false;
+ }
+
/**
* Evaluate an AST with only one argument (i.e. head[arg1]
). The evaluation steps are
* controlled by the header attributes.
@@ -1437,11 +1439,12 @@ private IExpr evalNoAttributes(IASTMutable mutableAST) {
}
final int astSize = mutableAST.size();
final boolean localNumericMode = fNumericMode;
+ final boolean argNumericMode = isNumericArg(mutableAST);
IASTMutable[] rlist = new IASTMutable[] {F.NIL};
mutableAST.forEach(1, astSize, (arg, i) -> {
if (!arg.isUnevaluated()) {
fNumericMode = localNumericMode;
- evalArg(rlist, mutableAST, arg, i, false);
+ evalArg(rlist, mutableAST, arg, i, argNumericMode);
}
});
if (rlist[0].isPresent()) {
diff --git a/symja_android_library/matheclipse-core/src/main/java/org/matheclipse/core/expression/F.java b/symja_android_library/matheclipse-core/src/main/java/org/matheclipse/core/expression/F.java
index 196d6c33a1..d799dfc8a5 100644
--- a/symja_android_library/matheclipse-core/src/main/java/org/matheclipse/core/expression/F.java
+++ b/symja_android_library/matheclipse-core/src/main/java/org/matheclipse/core/expression/F.java
@@ -234,6 +234,13 @@ public void createUserSymbol(ISymbol symbol) {}
public static final AbstractAST.NILPointer INVALID = AbstractAST.INVALID;
// public final static ISymbol usage = initFinalHiddenSymbol("usage");
+ /**
+ * Built-in function IDs those arguments should be evaluated numerically in numeric mode:
+ */
+ public static final int[] SORTED_NUMERIC_ARGS_IDS = new int[] {//
+ ID.Equal, ID.Greater, ID.GreaterEqual, ID.Labeled, ID.Less, ID.LessEqual, ID.Unequal //
+ };
+
/**
* Used to represent a formal pattern a_
that will be used only for predefined
* pattern-matching rules and can match one expression.
diff --git a/symja_android_library/matheclipse-core/src/test/java/org/matheclipse/core/system/LowercaseTestCase.java b/symja_android_library/matheclipse-core/src/test/java/org/matheclipse/core/system/LowercaseTestCase.java
index 386b8a4534..475dd9e8d6 100644
--- a/symja_android_library/matheclipse-core/src/test/java/org/matheclipse/core/system/LowercaseTestCase.java
+++ b/symja_android_library/matheclipse-core/src/test/java/org/matheclipse/core/system/LowercaseTestCase.java
@@ -15984,6 +15984,10 @@ public void testN() {
"x==-1.5708");
check("ConditionalExpression(x==-157079632679/100000000000*C(1),C(1)∈Integers) // N", //
"ConditionalExpression(x==-1.5708*C(1),C(1)∈Integers)");
+ check("f(1/3)//N", //
+ "f(0.333333)");
+ check("f(1/2*x)//N", //
+ "f(0.5*x)");
check("N({Labeled(4/3,\"test\")})", //
"{Labeled(1.33333,test)}");
check("N(Labeled(4/3,\"test\"))", //