Initial commit: Pi calculation benchmark with 34 languages

- Added implementations for: bash, brainfuck, c, cpp, crystal, csharp, d, dart, elixir, erlang, fortran, go, haskell, java, javascript, julia, kotlin, objective-c, scala, typescript, lua, nim, odin, perl, php, python, r, ruby, rust, swift, zig, assembly, vimscript, wolfram
- All implementations use Machin's formula: π/4 = 4*arctan(1/5) - arctan(1/239)
- Build system with ./build.sh, test system with ./test.sh
- Performance testing with ./run_all.sh
- Comprehensive README.md explaining performance differences
- Test framework verifies correctness against known π values
This commit is contained in:
Ein Anderssono
2026-04-23 00:26:18 +02:00
commit 54d2fecee0
182 changed files with 17471 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
package main
import "core:fmt"
import "core:strings"
main :: proc() {
// Test string building
builder: strings.Builder
strings.builder_init(&builder, context.temp_allocator)
// Test 1: Using fmt.sbprintf
fmt.sbprintf(&builder, "{}", 123)
fmt.sbprintf(&builder, "{:09}", 456)
result := strings.to_string(builder)
fmt.println("Result:", result)
// Test 2: Using append to dynamic array
bytes: [dynamic]u8
append(&bytes, 51) // 3
append(&bytes, 46) // .
append(&bytes, 49) // 1
append(&bytes, 52) // 4
str := string(bytes[:])
fmt.println("String from bytes:", str)
}