54d2fecee0
- 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
28 lines
654 B
Odin
28 lines
654 B
Odin
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)
|
|
}
|