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) {
// mtime side-effect
using (FileStream fs = File.Create("./one")) { }
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);
// mtime side-effect
using (FileStream fs = File.Create("./two")) { }
}
}
notes, command-line, and program output
NOTES:
64-bit Ubuntu quad core
.NET SDK 8.0.301
Host Version: 8.0.6
Commit: 3b8b000a0e
<OutputType>Exe
<TargetFramework>net8.0
<ImplicitUsings>enable
<Nullable>enable
<AllowUnsafeBlocks>true
<ServerGarbageCollection>true
<ConcurrentGarbageCollection>true
<PublishAot>false
Sat, 21 Sep 2024 22:08:19 GMT
MAKE:
cp toosimple.csharpcore Program.cs
cp Include/csharpcore/program.csproj .
mkdir obj
cp Include/csharpcore/project.assets.json ./obj
~/dotnet/dotnet build -c Release --use-current-runtime
Determining projects to restore...
/home/dunham/all-benchmarksgame/benchmarksgame_i53330/toosimple/tmp/program.csproj : warning NU1900: Error occurred while getting package vulnerability data: Unable to load the service index for source https://api.nuget.org/v3/index.json.
Restored /home/dunham/all-benchmarksgame/benchmarksgame_i53330/toosimple/tmp/program.csproj (in 6.01 sec).
/home/dunham/all-benchmarksgame/benchmarksgame_i53330/toosimple/tmp/program.csproj : warning NU1900: Error occurred while getting package vulnerability data: Unable to load the service index for source https://api.nuget.org/v3/index.json.
program -> /home/dunham/all-benchmarksgame/benchmarksgame_i53330/toosimple/tmp/bin/Release/net8.0/linux-x64/program.dll
Build succeeded.
/home/dunham/all-benchmarksgame/benchmarksgame_i53330/toosimple/tmp/program.csproj : warning NU1900: Error occurred while getting package vulnerability data: Unable to load the service index for source https://api.nuget.org/v3/index.json.
/home/dunham/all-benchmarksgame/benchmarksgame_i53330/toosimple/tmp/program.csproj : warning NU1900: Error occurred while getting package vulnerability data: Unable to load the service index for source https://api.nuget.org/v3/index.json.
2 Warning(s)
0 Error(s)
Time Elapsed 00:00:15.09
18.42s to complete and log all make actions
COMMAND LINE:
./bin/Release/net8.0/linux-x64/program 10000000000
PROGRAM OUTPUT:
3.141592653