MathParser.org-mXparser version: v.5.0.5
Framework: java
A big value n for the BellNumber Bell(n) leads to an OutOfMemoryError.
public class Tester {
public static void callApi(String input){
Expression e = new Expression(input);
e.setVerboseMode();
if(e.checkSyntax()){
e.calculate();
}
}
public static void main(String[] args){
callApi("Bell(999999*9999999)");
}
}
Log:
[mXparser-v.5.0.5]
[][Bell(9999999999999)]
[][Bell(9999999999999)] Starting ...
[][Bell(9999999999999)] Starting calculation loop
[][Bell(9999999999999)] Parsing (1, 5) ---> ( 999999.0 * 9999999.0 ) ... ---> Bell ( 9.999989000001E12 ) ... done
[][Bell(9999999999999)] Parsing (1, 3) ---> ( 9.999989000001E12 ) ... ---> Bell 9.999989000001E12 ... done
[][Bell(9999999999999)] Parsing (0, 1) ---> Bell 9.999989000001E12 ... Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at org.mariuszgromada.math.mxparser.mathcollection.MathFunctions.bellNumber(MathFunctions.java:300)
at org.mariuszgromada.math.mxparser.mathcollection.MathFunctions.bellNumber(MathFunctions.java:328)
at org.mariuszgromada.math.mxparser.Expression.BELL_NUMBER(Expression.java:3558)
at org.mariuszgromada.math.mxparser.Expression.f1ArgCalc(Expression.java:6373)
at org.mariuszgromada.math.mxparser.Expression.calculate(Expression.java:6179)
at org.mariuszgromada.math.mxparser.Expression.calculate(Expression.java:5666)
at Tester.callApi(Tester.java:11)
at Tester.main(Tester.java:17)
I tried other java algorithms found on the web but they also had the same result. So probably should just catch the Exception.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4