The Computer Language
24.04 Benchmarks Game

too simple Java OpenJ9 #2 program

source code

/* The Computer Language Benchmarks Game
   https://salsa.debian.org/benchmarksgame-team/benchmarksgame/
*/

class toosimple {
public static void main(String[] args) {   
    long n = Long.parseLong(args[0]);
    double sum = 0.0;
    double flip = 1.0;
    for (long i = 1; i <= n; i++) {           
        sum += flip / (2*i - 1);   
        flip *= -1.0;         
    }                        
    System.out.printf("%.9f\n", sum*4.0);   
}
}
    

notes, command-line, and program output

NOTES:
64-bit Ubuntu quad core
javac 21.0.2



 Sat, 09 Mar 2024 22:54:18 GMT

MAKE:
mv toosimple.openj9-2.openj9 toosimple.java
/opt/src/ibm-semeru-21.0.2.0/bin/javac -d .  toosimple.java

1.45s to complete and log all make actions

COMMAND LINE:
 /opt/src/ibm-semeru-21.0.2.0/bin/java -Xshareclasses -XX:SharedCacheHardLimit=200m -Xscmx60m -Xtune:virtualized   toosimple 10000000000

PROGRAM OUTPUT:
3.141592653