The Computer Language
24.04 Benchmarks Game

too simple Intel C program

source code

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

#include<stdio.h>
#include <stdlib.h>

int main(int argc, char **argv)
{
    long n = atol(argv[1]);
    double sum = 0.0;
    double flip = -1.0;
    for (long i = 1; i <= n; i++) {    
        flip *= -1.0;        
        sum += flip / (2*i - 1);               
    }                        
    printf("%.9f\n", sum*4.0);
    return 0;      
}
    

notes, command-line, and program output

NOTES:
64-bit Ubuntu quad core
Intel(R) oneAPI DPC++/C++ Compiler
2024.0.2.20231213


 Mon, 04 Mar 2024 21:40:51 GMT

MAKE:
~/intel/oneapi/compiler/latest/bin/icx -pipe -Wall -O3 -fomit-frame-pointer -march=ivybridge  toosimple.c -o toosimple.icx_run 
rm toosimple.c

4.37s to complete and log all make actions

COMMAND LINE:
 ./toosimple.icx_run 10000000000

PROGRAM OUTPUT:
3.141592649