Description.
When not-evaluated number (e.g. Pi or 1/7) is passed toN(numeric, precision) as numeric argument, function does not evaluate it to specified precision, if precision is less than 17.
1. Example. Precision = 15
ExprEvaluator evaluator = new ExprEvaluator();
IExpr result = evaluator.eval("N(1/7, 15)");
System.out.println(result);
System.out.println(result.fullFormString());
Output:
0.142857
0.14285714285714285`
Expected output:
0.142857142857143
0.142857142857143`
2. Example. Precision = 3
ExprEvaluator evaluator = new ExprEvaluator();
IExpr result = evaluator.eval("N(1/7, 3)");
System.out.println(result);
System.out.println(result.fullFormString());
Output:
0.142857
0.14285714285714285`
Expected output:
3. Example. Precision = 17
ExprEvaluator evaluator = new ExprEvaluator();
IExpr result = evaluator.eval("N(1/7, 17)");
System.out.println(result);
System.out.println(result.fullFormString());
Output:
1.4285714285714285*10^-1
1.4285714285714285`17*^-1
Expected output:
1.4285714285714285
1.4285714285714285 (basically, exactly what was expected).
I believe this is a bug, since matheclipse.org and NCalc+ both produce Expected outputs on the same inputs:


Summary
precision of less than 17 in N() evaluates number to actual precision of 16 (as seemingly evident by .fullFormString() and even more confusingly, toString() representation has precision of 5 or sometimes 6.
Prerequisites
- Java 17
- Matheclipse 3.1.0-SNAPSHOT
Description.
When not-evaluated number (e.g.
Pior1/7) is passed toN(numeric, precision)asnumericargument, function does not evaluate it to specifiedprecision, ifprecisionis less than 17.1. Example. Precision = 15
Output:
Expected output:
2. Example. Precision = 3
Output:
Expected output:
3. Example. Precision = 17
Output:
Expected output:
I believe this is a bug, since matheclipse.org and NCalc+ both produce Expected outputs on the same inputs:
Summary
precisionof less than 17 inN()evaluates number to actualprecisionof 16 (as seemingly evident by.fullFormString()and even more confusingly,toString()representation has precision of5or sometimes6.Prerequisites