The Computer Language
24.04 Benchmarks Game

too simple C# .NET 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 = Int64.Parse(args[0]);
    double sum = 0.0;
    double flip = -1.0;
    for (long i = 1; i <= n; i++) {    
        flip *= -1.0;        
        sum += flip / (2*i - 1);               
    }  
    Console.WriteLine("{0:f9}", sum*4.0);	
}
}
    

notes, command-line, and program output

NOTES:
64-bit Ubuntu quad core
.NET SDK 8.0.204
Host Version: 8.0.4
Commit: 2d7eea2529
<AllowUnsafeBlocks>true
<ServerGarbageCollection>true
<ConcurrentGarbageCollection>true
<PublishAot>false
<OptimizationPreference>Speed
<IlcInstructionSet>native


 Fri, 26 Apr 2024 01:25:16 GMT

MAKE:
cp toosimple.csharpcore Program.cs
cp Include/csharpcore/program.csproj .
mkdir obj
cp Include/csharpcore/project.assets.json ./obj
/usr/bin/dotnet build -c Release --use-current-runtime  	
MSBuild version 17.9.8+b34f75857 for .NET
  Determining projects to restore...
  Restored /home/dunham/all-benchmarksgame/benchmarksgame_i53330/toosimple/tmp/program.csproj (in 178 ms).
  program -> /home/dunham/all-benchmarksgame/benchmarksgame_i53330/toosimple/tmp/bin/Release/net8.0/linux-x64/program.dll

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:03.85

5.49s to complete and log all make actions

COMMAND LINE:
 ./bin/Release/net8.0/linux-x64/program 10000000000

PROGRAM OUTPUT:
3.141592653