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
+99
View File
@@ -0,0 +1,99 @@
# Build artifacts
bin/
*.o
*.out
*.exe
*.app
*.dSYM/
# Compiled files
*.class
*.jar
*.beam
*.pyc
*.pyo
__pycache__/
# Dependencies
node_modules/
target/
vendor/
# IDE files
.vscode/
.idea/
*.swp
*.swo
*~
# OS files
.DS_Store
Thumbs.db
# Temporary files
*.tmp
*.temp
*.log
# Language specific
# C/C++
*.d
*.hi
# D
*.o
# Erlang
erl_crash.dump
# Go
*.test
# Haskell
*.hi
# Java
*.class
# Julia
*.jl.cach
*.jl.mem
# Kotlin
*.class
# Lua
*.luac
# Nim
nimcache/
# Odin
*.o
# Rust
target/
# Swift
.build/
Package.resolved
# TypeScript
*.js
*.js.map
*.d.ts
# Wolfram
*.wls
# Vim
*.swp
*.swo
# Test results
test_results/
*.test
# Profiling
*.prof
*.profdata
+652
View File
@@ -0,0 +1,652 @@
# Agent: Lägg till nytt programmeringsspråk
## Översikt
För att lägga till ett nytt programmeringsspråk till pi-beräkningsprojektet, följ dessa steg exakt.
## VIKTIGT: Undantag för Bash
**Bash är ett UNDANTAG** och används endast som referenskod. Bash använder `bc -l` med formeln `4*a(1)` för att beräkna pi, vilket är en annan algoritm än Machins formel. Bash inkluderas inte i prestandajämförelser och kraven nedan gäller inte för Bash.
Alla andra språk (Go, Rust, Python, C, C++, Haskell, Erlang, etc.) MÅSTE följa reglerna nedan exakt.
## Steg 1: Skapa katalogstruktur
Skapa en ny katalog i projektroten med språkets namn (gemener) med följande struktur:
```
/Users/einand/Code/test/<språk>/
├── bin/ # Kompilerade binärer eller wrapper-scripts
│ └── print_hej # Den körbara filen
├── src/ # Källkod
│ └── print_hej.<extension> # Källkodsfilen
└── cmd/ # Kommandon och scripts
├── build.sh # Byggscript
└── test.sh # Testscript
```
Exempel:
- `python/src/print_hej.py`
- `python/bin/print_hej` (wrapper script)
- `python/cmd/build.sh`
- `python/cmd/test.sh`
- `rust/src/print_hej.rs`
- `rust/bin/print_hej` (kompilerad binär)
- `rust/cmd/build.sh`
- `rust/cmd/test.sh`
## Steg 2: Skapa programfil
Skapa en fil som heter `print_hej.<extension>` i `src/`-katalogen.
### Obligatoriska krav för programmet:
1. **Ta emot argument**: Programmet ska acceptera ett kommandoradsargument med antal decimaler att beräkna.
- Om inget argument ges, använd default 100 decimaler
- Om ogiltigt argument, använd default 100 decimaler
2. **Beräkna pi korrekt**: Använd Machins formel med Taylor-serien för arctan.
- Machins formel: `pi/4 = 4*arctan(1/5) - arctan(1/239)`
- Taylor-serien för arctan: `arctan(1/x) = 1/x - 1/(3*x^3) + 1/(5*x^5) - ...`
## Steg 2.5: OBLIGATORISK ALGORITM
**VIKTIGT**: Alla implementationer MÅSTE använda exakt samma algoritm för att säkerställa rättvis jämförelse mellan språk.
### Den obligatoriska algoritmen för arctan(1/x):
```
function arctan(x, decimals):
scale = 10^(decimals + 10)
x_squared = x * x
term = scale / x
result = 0
sign = 1
n = 0
while term != 0 AND n < decimals * 3:
// Add contribution with sign
contrib = term / (2*n + 1)
if sign > 0:
result = result + contrib
else:
result = result - contrib
// Next term: divide by x²
term = term / x_squared
// Flip sign
sign = -sign
n = n + 1
// Safety limit
if n > decimals * 2:
break
return result
```
### Nyckelpunkter för algoritmen:
1. **Skala med 10^(decimals+10)**: Använd heltalsaritmetik med skalfaktor för precision
2. **Dela med x² varje iteration**: Detta är den kritiska optimeringen!
-**FEL**: Beräkna `x^(2n+1)` från grunden varje iteration (mycket långsamt)
-**RÄTT**: `term = term / x²` varje iteration (snabbt)
3. **Använd teckenväxling**: `sign = -sign` för att alternera mellan addition och subtraktion
4. **Säkerhetsgräns**: `n < decimals * 3` för att undvika oändliga loopar
### Varför denna algoritm?
Denna algoritm är **optimerad** för godtycklig precision:
- **Effektivitet**: Att dela med `x²` varje iteration är O(n) operation
- **Jämförbarhet**: Alla språk använder samma algoritm, vilket ger rättvis prestandajämförelse
- **Korrekthet**: Algoritmen konvergerar snabbt och ger exakta resultat
### Exempel på implementationer:
**Python:**
```python
def arctan(x, precision):
result = Decimal(0)
x = Decimal(x)
x_squared = x * x
term = Decimal(1) / x
sign = 1
for n in range(1000000):
divisor = Decimal(2 * n + 1)
contrib = term / divisor
if sign > 0:
result += contrib
else:
result -= contrib
term = term / x_squared
sign = -sign
if term < Decimal(10) ** (-precision - 10):
break
return result
```
**Rust:**
```rust
fn arctan_big(x: u32, scale: &BigUint) -> BigUint {
let mut result = BigUint::zero();
let x_big = BigUint::from(x);
let x_squared = &x_big * &x_big;
let mut term = scale / &x_big;
let mut sign: i32 = 1;
let mut n: u64 = 0;
loop {
let divisor = BigUint::from(2u64 * n + 1);
let contrib = &term / &divisor;
if sign > 0 {
result = &result + &contrib;
} else {
result = &result - &contrib;
}
term = &term / &x_squared;
sign = -sign;
if term.is_zero() || n > 5000000 {
break;
}
n += 1;
}
result
}
```
**C:**
```c
void arctan(mpz_t result, unsigned long x, unsigned long decimals) {
mpz_t term, x_squared, contrib;
mpz_init(term);
mpz_init(x_squared);
mpz_init(contrib);
mpz_t scale;
mpz_init(scale);
mpz_ui_pow_ui(scale, 10, decimals + 10);
mpz_set_ui(x_squared, x);
mpz_mul_ui(x_squared, x_squared, x);
mpz_fdiv_q_ui(term, scale, x);
mpz_set_ui(result, 0);
unsigned long n = 0;
int sign = 1;
while (mpz_cmp_ui(term, 0) != 0 && n < decimals * 3) {
mpz_fdiv_q_ui(contrib, term, 2 * n + 1);
if (sign > 0) {
mpz_add(result, result, contrib);
} else {
mpz_sub(result, result, contrib);
}
mpz_fdiv_q(term, term, x_squared);
sign = -sign;
n++;
if (n > decimals * 2) break;
}
mpz_clear(term);
mpz_clear(x_squared);
mpz_clear(contrib);
mpz_clear(scale);
}
```
### Steg 4: Utdataformat
Programmet ska skriva ut pi med exakt antal decimaler, följt av newline.
- Format: `3.1415926535...` (inga extra tecken, ingen avrundning)
- Exakt `<antal_decimaler>` decimaler efter punkten
5. **Inga extra utskrifter**: Endast pi-värdet ska skrivas ut, inga debug-meddelanden eller statusinformation.
### Exempel på korrekt utdata:
```
$ bin/print_hej 10
3.1415926535
$ bin/print_hej 5
3.14159
$ bin/print_hej 100
3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679
```
## Steg 5: Använd godtycklig precision (Arbitrary Precision)
Programmet MÅSTE använda godtycklig precision (arbitrary precision) aritmetik för att beräkna pi korrekt med många decimaler.
### Språkspecifika bibliotek:
| Språk | Bibliotek | Användning |
|-------|-----------|------------|
| Python | `decimal.Decimal` | `from decimal import Decimal, getcontext` |
| Rust | `num-bigint` | `use num_bigint::BigUint;` |
| Go | `math/big` | `import "math/big"` |
| Bash | `bc -l` | `echo "scale=$decimals; 4*a(1)" \| bc -l` |
| C | `GMP` eller egen implementation | `#include <gmp.h>` |
| C++ | `boost::multiprecision` | `#include <boost/multiprecision/cpp_int.hpp>` |
| Java | `BigInteger` / `BigDecimal` | `import java.math.BigInteger;` |
| JavaScript | `big-integer` eller `decimal.js` | `npm install big-integer` |
| Ruby | `BigDecimal` | `require 'bigdecimal'` |
### Viktigt om precision:
- Sätt precision till minst `decimals + 10` för att undvika avrundningsfel
- Använd heltalsaritmetik där det är möjligt (skala med 10^n)
- Kontrollera att resultatet matchar facit.txt
## Steg 6: Kompilera (om nödvändigt)
Om språket kräver kompilering:
### Kompilerade språk:
1. **Rust**: Skapa `Cargo.toml` med beroenden
```toml
[dependencies]
num-bigint = "0.4"
num-traits = "0.2"
```
Kompilera: `cargo build --release`
Binär: `bin/print_hej`
2. **Go**: Ingen extra konfiguration behövs
Kompilera: `go build -o bin/print_hej src/print_hej.go`
3. **C/C++**: Skapa `Makefile` eller kompilera manuellt
Kompilera: `gcc -o bin/print_hej src/print_hej.c -lgmp`
### Tolkade språk:
Ingen kompilering behövs. Skapa ett wrapper-script i `bin/`:
```bash
#!/bin/bash
# Wrapper script for interpreted languages
SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
cd "$SCRIPT_DIR"
<interpreter> src/print_hej.<extension> "$@"
```
## Steg 7: Skapa build.sh (OBLIGATORISKT)
**VIKTIGT**: Varje språk MÅSTE ha en `build.sh` i `cmd/`-katalogen som bygger programmet.
Skapa filen `<språk>/cmd/build.sh` med följande innehåll:
### För kompilerade språk:
```bash
#!/bin/bash
# <Språk> Build Script
SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
cd "$SCRIPT_DIR"
echo "=== <Språk> Build ==="
echo ""
# Skapa bin-katalog
mkdir -p bin
# Kompilera programmet
<kompilationskommando> -o bin/print_hej src/print_hej.<extension>
if [ $? -eq 0 ]; then
echo "✓ Kompilering lyckades!"
echo "Binär: bin/print_hej"
echo ""
echo "För att köra:"
echo " bin/print_hej [decimaler]"
else
echo "✗ Kompilering misslyckades!"
exit 1
fi
```
### För interpreterade språk:
```bash
#!/bin/bash
# <Språk> Build Script - <Språk> är interpreterat, ingen kompilering behövs
SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
cd "$SCRIPT_DIR"
echo "=== <Språk> Build ==="
echo "<Språk> är ett interpreterat språk, ingen kompilering behövs."
echo "Script: src/print_hej.<extension>"
echo ""
echo "Skapar wrapper script i bin/"
mkdir -p bin
cat > bin/print_hej << 'EOF'
#!/bin/bash
SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
cd "$SCRIPT_DIR"
<interpreter> src/print_hej.<extension> "$@"
EOF
chmod +x bin/print_hej
echo "✓ Klart!"
```
### Exempel:
**C:**
```bash
#!/bin/bash
SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
cd "$SCRIPT_DIR"
echo "=== C Build ==="
mkdir -p bin
gcc -o bin/print_hej src/print_hej.c -lgmp
if [ $? -eq 0 ]; then
echo "✓ Kompilering lyckades!"
else
echo "✗ Kompilering misslyckades!"
exit 1
fi
```
**Python:**
```bash
#!/bin/bash
SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
cd "$SCRIPT_DIR"
echo "=== Python Build ==="
mkdir -p bin
cat > bin/print_hej << 'EOF'
#!/bin/bash
SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
cd "$SCRIPT_DIR"
python3 src/print_hej.py "$@"
EOF
chmod +x bin/print_hej
echo "✓ Klart!"
```
## Steg 8: Skapa test.sh (OBLIGATORISKT)
**VIKTIGT**: Tester är OBLIGATORISKT, inte valfria. Varje nytt språk MÅSTE ha tester.
Skapa filen `<språk>/cmd/test.sh` som kör språkets testramverk:
### För språk med testramverk:
```bash
#!/bin/bash
# <Språk> Unit Tests - använder <testramverk>
SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
cd "$SCRIPT_DIR"
echo "=== <Språk> Pi-beräkning Unit Tester (<testramverk>) ==="
echo ""
# Kör testramverket
<testkommando>
exit $?
```
### Exempel per språk:
**Python (pytest):**
```bash
#!/bin/bash
SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
cd "$SCRIPT_DIR"
echo "=== Python Pi-beräkning Unit Tester (pytest) ==="
/Users/einand/Code/test/.venv/bin/python -m pytest src/test_pi.py -v
exit $?
```
**JavaScript (Jest):**
```bash
#!/bin/bash
SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
cd "$SCRIPT_DIR"
echo "=== JavaScript Pi-beräkning Unit Tester (Jest) ==="
npm test
exit $?
```
**Go (go test):**
```bash
#!/bin/bash
SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
cd "$SCRIPT_DIR"
echo "=== Go Pi-beräkning Unit Tester (go test) ==="
go test -v
exit $?
```
**Rust (cargo test):**
```bash
#!/bin/bash
SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
cd "$SCRIPT_DIR"
echo "=== Rust Pi-beräkning Unit Tester (cargo test) ==="
cargo test
exit $?
```
**C (assert):**
```bash
#!/bin/bash
SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
cd "$SCRIPT_DIR"
echo "=== C Pi-beräkning Unit Tester (assert) ==="
gcc -o bin/pi_test src/pi_test.c
bin/pi_test
exit $?
```
### Obligatoriska tester:
Varje testfil ska innehålla följande testfall:
1. **Testa 10 decimaler**: Resultatet ska vara `3.1415926535`
2. **Testa 5 decimaler**: Resultatet ska vara `3.14159`
3. **Testa 1 decimal**: Resultatet ska vara `3.1`
4. **Testa 100 decimaler**: Resultatet ska matcha facit.txt
5. **Testa default (100 decimaler)**: Resultatet ska matcha facit.txt
6. **Testa ogiltig input**: Ska använda default (100 decimaler)
7. **Testa 10000 decimaler**: Resultatet ska matcha facit.txt
## Steg 9: Verifiera
Kör `build.sh` och `test.sh` för att verifiera:
```bash
# Bygg programmet
cd <språk>
cmd/build.sh
# Kör tester
cmd/test.sh
# Eller kör alla builds och tester från roten
cd /Users/einand/Code/test
./build.sh # Bygger alla språk
./run_all_tests.sh # Kör alla tester
```
Alla tester ska passera för det nya språket.
## Steg 10: Dokumentation
Lägg till en README.md i språkkatalogen med:
1. **Beskrivning**: Kort beskrivning av implementationen
2. **Krav**: Nödvändiga beroenden och versioner
3. **Kompilering**: Instruktioner för att kompilera (om nödvändigt)
4. **Körning**: Instruktioner för att köra programmet
5. **Prestanda**: Notering om prestanda jämfört med andra språk
### Exempel på README.md:
```markdown
# Python Pi-beräkning
## Beskrivning
Beräknar pi med godtycklig precision med hjälp av Machins formel.
## Struktur
```
python/
├── bin/
│ └── print_hej # Wrapper script
├── src/
│ └── print_hej.py # Källkod
└── cmd/
├── build.sh # Byggscript
└── test.sh # Testscript
```
## Krav
- Python 3.6+
- Inga externa beroenden (använder `decimal` från standardbiblioteket)
## Körning
```bash
# Bygg (skapar wrapper script)
cmd/build.sh
# Kör
bin/print_hej <antal_decimaler>
```
## Prestanda
- 10 decimaler: ~100 ms
- 100 decimaler: ~40 ms
- 10000 decimaler: ~500 ms
```
## Vanliga problem och lösningar
### Problem: "Avrundningsfel vid många decimaler"
**Lösning**: Öka precisionen i beräkningen. Sätt precision till minst `decimals + 20` för att undvika avrundningsfel i sista siffrorna.
### Problem: "Programmet är för långsamt"
**Lösning**:
- Använd Machins formel istället för Leibniz formel (konvergerar snabbare)
- Optimera arctan-funktionen med bättre algoritmer
- Använd språkets optimerade bibliotek för stor heltalsaritmetik
### Problem: "Resultatet matchar inte facit.txt"
**Lösning**:
- Kontrollera att du inte avrundar resultatet
- Se till att du klipper till exakt rätt antal decimaler
- Verifiera att algoritmen är korrekt implementerad
### Problem: "Kompileringsfel med beroenden"
**Lösning**:
- Se till att alla beroenden är installerade
- Kontrollera versioner av bibliotek
- Använd container för att isolera miljön
## Facit
Facit finns i `/Users/einand/Code/test/facit.txt` och innehåller pi med 10000+ decimaler.
## Struktur
```
/Users/einand/Code/test/
├── bash/
│ ├── bin/
│ │ └── print_hej
│ ├── src/
│ │ └── print_hej.sh
│ └── cmd/
│ ├── build.sh
│ └── test.sh
├── go/
│ ├── bin/
│ │ └── print_hej
│ ├── src/
│ │ ├── print_hej.go
│ │ └── print_hej_test.go
│ └── cmd/
│ ├── build.sh
│ └── test.sh
├── rust/
│ ├── bin/
│ │ └── print_hej
│ ├── src/
│ │ └── print_hej.rs
│ └── cmd/
│ ├── build.sh
│ └── test.sh
├── python/
│ ├── bin/
│ │ └── print_hej
│ ├── src/
│ │ ├── print_hej.py
│ │ └── test_pi.py
│ └── cmd/
│ ├── build.sh
│ └── test.sh
├── <nytt_språk>/
│ ├── bin/
│ │ └── print_hej
│ ├── src/
│ │ └── print_hej.<extension>
│ └── cmd/
│ ├── build.sh
│ └── test.sh
└── facit.txt # Facit för verifiering
```
## Sammanfattning
För att lägga till ett nytt språk:
1. Skapa katalogstruktur `<språk>/{bin,src,cmd}/`
2. Skapa `src/print_hej.<extension>` med korrekt implementation
3. **Använd den obligatoriska algoritmen** (se Steg 2.5)
4. Använd godtycklig precision (arbitrary precision)
5. Skapa `cmd/build.sh` (OBLIGATORISKT) - bygger programmet
6. Skapa `cmd/test.sh` (OBLIGATORISKT) - kör testramverket
7. Skapa testfiler för språkets testramverk (t.ex. `src/test_pi.py`, `src/pi_test.go`)
8. Verifiera med `cmd/build.sh` och `cmd/test.sh`
9. Dokumentera i README.md
**VIKTIGT**:
- Alla implementationer MÅSTE använda exakt samma algoritm (se Steg 2.5) för att säkerställa rättvis prestandajämförelse
- `cmd/build.sh` och `cmd/test.sh` är OBLIGATORISKA, inte valfria
- Tester ska använda språkets standardiserade testramverk (pytest, Jest, go test, etc.)
- Binären/wrappern ska placeras i `bin/`-katalogen
- Källkoden ska placeras i `src/`-katalogen
- Scripts ska placeras i `cmd/`-katalogen
Följ dessa steg exakt för att säkerställa att det nya språket fungerar korrekt med resten av projektet.
+410
View File
@@ -0,0 +1,410 @@
# Pi-beräkningsbenchmark 🥧
## Vad är detta? 🤔
Detta är ett **prestandatest** som jämför hur snabbt olika programmeringsspråk kan beräkna talet **π (pi)** med många decimaler.
**Pi (π)** är ett matematiskt konstant som börjar med `3.14159...` och fortsätter i evighet utan att upprepa sig. Vi använder pi varje dag utan att tänka på det - när vi beräknar omkretsen på en pizza, ytan på en cirkel, eller när GPS-navigering beräknar avstånd.
## Varför göra detta? 🎯
1. **Lära oss om programmeringsspråk** - Olika språk fungerar på olika sätt
2. **Förstå prestandaskillnader** - Varför är vissa språk snabbare än andra?
3. **Ha kul!** - Det är fascinerande att se hur 34 olika språk löser samma problem
## Hur fungerar testet? ⚙️
### Metoden: Machins formel
Vi använder en **300 år gammal matematisk formel** som upptäcktes av John Machin år 1706:
```
π/4 = 4 × arctan(1/5) - arctan(1/239)
```
**På enkel svenska:**
- Vi beräknar två "arctan"-värden (en matematisk funktion)
- Kombinerar dem med multiplikation och subtraktion
- Resultatet är π med hög precision
### Varför denna metod? ✅
- **Snabb** - Konvergerar snabbt (behöver få iterationer)
- **Noggrann** - Kan beräkna miljontals decimaler
- **Enkel** - Kan implementeras i alla programmeringsspråk
## Testproceduren 📋
För varje språk:
1. **Bygg** programmet (om det behöver kompileras)
2. **Kör** programmet med olika antal decimaler: 1, 2, 5, 10, 100, 1000, 10000
3. **Jämför** resultatet med det korrekta värdet av π
4. **Mät** hur lång tid det tar
## Varför så stor skillnad i tid? ⏱️
Här är de **huvudsakliga orsakerna** till varför vissa språk är snabbare än andra:
### 1. **Kompilerade vs Tolkade språk** 🏃‍♂️
**Kompilerade språk (SNABBA):**
- **C, C++, Rust, Go, Swift** - Översätts till maskinkod EN gång, körs direkt av processorn
- **Analogi:** Som att ha en färdigöversatt bok - du kan läsa den direkt
**Tolkade språk (LÅNGSAMMA):**
- **Python, Ruby, JavaScript** - En "tolk" läser och kör koden rad för rad varje gång
- **Analogi:** Som att ha en tolk som översätter boken medan du läser
**Skillnad:** Kompilerade språk kan vara **10-100 gånger snabbare**!
### 2. **Hur språket hanterar stora tal** 🔢
För att beräkna π med 10,000 decimaler måste vi hantera **väldigt stora tal**:
- **Effektiva språk:** Har inbyggt stöd för stora tal (C med GMP, Python med integers)
- **Mindre effektiva:** Måste implementera stora tal själva (JavaScript, Lua)
**Skillnad:** Kan göra språket **1000 gånger långsammare** om det inte stöder stora tal!
### 3. **Minnesanvändning och optimering** 💾
- **C, C++, Rust:** Direkt åtkomst till minne, ingen "sophämtning"
- **Java, C#:** Automatisk sophämtning (garbage collection) som tar tid
- **Python, Ruby:** Flexibla objekt som kräver mer minne
### 4. **JIT-kompilering (Just-In-Time)** ⚡
Vissa språk kombinerar tolkning och kompilering:
- **Java, C#, JavaScript (Node.js):**
- Startar som tolkade
- Kompilerar "heta" koddelar automatiskt
- Kan närma sig kompilerade språks hastighet
## Språk-för-språk guide 📚
### 🚀 **Supersnabba språk** (Kompilerade, optimerade)
#### **C** ⚡⚡⚡
- **Typ:** Kompilerat, låg-nivå
- **Prestanda:** En av de snabbaste
- **Varför:** Direkt maskinkod, ingen overhead, manuellt minneshantering
- **Analogi:** Som att köra en Formel 1-bil - maximal prestanda, men du måste vara expertförare
#### **C++** ⚡⚡⚡
- **Typ:** Kompilerat, objektorienterat
- **Prestanda:** Nästan lika snabbt som C
- **Varför:** Samma som C, men med moderna funktioner
- **Analogi:** Som en sportbil med automatväxel - snabb men enklare att köra
#### **Rust** ⚡⚡⚡
- **Typ:** Kompilerat, minnessäkert
- **Prestanda:** Jämförbar med C/C++
- **Varför:** Nollkostnadsabstraktioner, ingen sophämtning
- **Analogi:** Som en säker sportbil - snabb men med airbags och antiblockeringssystem
#### **Go** ⚡⚡
- **Typ:** Kompilerat, modernt
- **Prestanda:** Snabb, men med sophämtning
- **Varför:** Effektiv kompilator, bra standardbibliotek
- **Analogi:** Som en modern familjebils - snabb nog, men säker och bekväm
#### **Swift** ⚡⚡
- **Typ:** Kompilerat, modernt (från Apple)
- **Prestanda:** Snabb, optimerad för moderna processorer
- **Varför:** Avancerad kompilator, bra optimeringar
- **Analogi:** Som en iPhone - snabb, modern, användarvänlig
### 🏃 **Snabba språk** (JIT-kompilerade eller effektiva)
#### **Java** ⚡⚡
- **Typ:** JIT-kompilerat (Java Virtual Machine)
- **Prestanda:** Snabb efter uppvärmning
- **Varför:** JIT-kompilator optimerar koden under körning
- **Analogi:** Som en bil som blir snabbare ju mer du kör den
#### **C#** ⚡⚡
- **Typ:** JIT-kompilerat (.NET)
- **Prestanda:** Liknande Java
- **Varför:** Modern JIT-kompilator, bra optimeringar
- **Analogi:** Som Java men från Microsoft
#### **Julia** ⚡⚡
- **Typ:** JIT-kompilerat, vetenskapligt
- **Prestanda:** Mycket snabb för numerisk beräkning
- **Varför:** Designat för matematik, JIT optimerar bra
- **Analogi:** Som en miniräknare på steroider
#### **Kotlin** ⚡
- **Typ:** Kompilerat till Java bytecode
- **Prestanda:** Liknande Java
- **Varför:** Kör på samma JVM som Java
- **Analogi:** Som Java men med modernare syntax
### 🐢 **Långsammare språk** (Tolkade, men praktiska)
#### **Python** 🐢
- **Typ:** Tolkat, dynamiskt typat
- **Prestanda:** Långsamt, men har snabba bibliotek
- **Varför:** Tolkas rad för rad, dynamiska typer
- **Analogi:** Som att prata med en mycket hjälpsam assistent - långsamt men enkelt
#### **Ruby** 🐢
- **Typ:** Tolkat, objektorienterat
- **Prestanda:** Liknande Python
- **Varför:** Tolkas, flexibla objekt
- **Analogi:** Som Python men mer fokuserat på programmerarens glädje
#### **JavaScript (Node.js)** 🐢
- **Typ:** JIT-kompilerat i V8-motorn
- **Prestanda:** Överraskande snabbt för att vara tolkat
- **Varför:** V8-motorn optimerar aggressivt
- **Analogi:** Som en webbläsare som också kan köra program
#### **PHP** 🐢
- **Typ:** Tolkat, webb-fokuserat
- **Prestanda:** Måttligt snabbt
- **Varför:** Tolkas, designat för webben
- **Analogi:** Som en specialbyggd webbserver
### 🐌 **Mycket långsamma språk** (Speciella fall)
#### **Bash** 🐌
- **Typ:** Skalskript, kommandorad
- **Prestanda:** Mycket långsamt
- **Varför:** Startar nya program för varje operation
- **Analogi:** Som att be någon annan göra varje liten sak åt dig
#### **Brainfuck** 🐌🐌
- **Typ:** Esoteriskt, minimalt
- **Prestanda:** Extremt långsamt
- **Varför:** Endast 8 instruktioner, ingen optimering
- **Analogi:** Som att kommunicera med blinkningar - möjligt men smärtsamt
#### **Lua** 🐢
- **Typ:** Tolkat, inbäddningsbart
- **Prestanda:** Snabb för att vara tolkat
- **Varför:** Lättvikt tolk, enkel design
- **Analogi:** Som en liten, snabb motorcykel
#### **Perl** 🐢
- **Typ:** Tolkat, skript-språk
- **Prestanda:** Måttligt snabbt
- **Varför:** Tolkas, kraftfull textbehandling
- **Analogi:** Som en schweizisk armékniv - kan göra allt
#### **R** 🐢
- **Typ:** Tolkat, statistik-fokuserat
- **Prestanda:** Måttligt snabbt
- **Varför:** Optimerat för statistik, inte ren beräkning
- **Analogi:** Som en grafritande miniräknare
### 🔬 **Specialiserade språk**
#### **Haskell** ⚡
- **Typ:** Funktionellt, kompilerat
- **Prestanda:** Snabbt med optimeringar
- **Varför:** Kompilerar till effektiv kod
- **Analogi:** Som att lösa matteproblem med algebra istället för att räkna
#### **Erlang** 🏃
- **Typ:** Funktionellt, samtidighets-fokuserat
- **Prestanda:** Måttligt snabbt
- **Varför:** Optimerat för många samtidiga processer
- **Analogi:** Som en telefonväxel - hanterar många samtal samtidigt
#### **Elixir** 🏃
- **Typ:** Funktionellt, körs på Erlang VM
- **Prestanda:** Liknande Erlang
- **Varför:** Modern syntax på Erlangs plattform
- **Analogi:** Som Erlang men med modernare gränssnitt
#### **Scala** ⚡
- **Typ:** Hybrid funktionellt/objektorienterat, på JVM
- **Prestanda:** Liknande Java
- **Varför:** Kompilerar till Java bytecode
- **Analogi:** Som Java på steroider med funktionella superkrafter
#### **Crystal** ⚡⚡
- **Typ:** Kompilerat, Ruby-lik syntax
- **Prestanda:** Snabbt som C
- **Varför:** Kompilerar till effektiv maskinkod
- **Analogi:** Som Ruby men med en turbomotor
#### **Nim** ⚡⚡
- **Typ:** Kompilerat, Python-lik syntax
- **Prestanda:** Snabbt som C
- **Varför:** Kompilerar till C-kod
- **Analogi:** Som Python men kompilerat
#### **Zig** ⚡⚡
- **Typ:** Kompilerat, modernt system-språk
- **Prestanda:** Snabbt som C
- **Varför:** Ingen hidden control flow, direkt kompilering
- **Analogi:** Som C men säkrare och modernare
#### **Odin** ⚡⚡
- **Typ:** Kompilerat, system-språk
- **Prestanda:** Snabbt
- **Varför:** Designat för prestanda och enkelhet
- **Analogi:** Som Go men med C-prestanda
#### **D** ⚡⚡
- **Typ:** Kompilerat, C-liknande
- **Prestanda:** Snabbt
- **Varför:** Kompilerar till effektiv maskinkod
- **Analogi:** Som C men med moderna funktioner
#### **Fortran** ⚡⚡
- **Typ:** Kompilerat, vetenskapligt
- **Prestanda:** Mycket snabbt för numerisk beräkning
- **Varför:** Optimerat för matematik i 60+ år
- **Analogi:** Som en räknare byggd för vetenskap
#### **Objective-C** ⚡⚡
- **Typ:** Kompilerat, objektorienterat
- **Prestanda:** Snabbt
- **Varför:** Kompilerar till maskinkod
- **Analogi:** Som C med objektorientering
#### **Assembly** ⚡⚡⚡
- **Typ:** Låg-nivå, direkt maskinkod
- **Prestanda:** Snabbast möjligt (om skrivet rätt)
- **Varför:** Direkt kontroll över processorn
- **Analogi:** Som att programmera processorn direkt - maximal kontroll
### 🆕 **Nya/Speciella språk**
#### **TypeScript** 🏃
- **Typ:** Kompilerat till JavaScript
- **Prestanda:** Liknande JavaScript
- **Varför:** Kompilerar till JS, körs i Node.js
- **Analogi:** Som JavaScript med typer
#### **Dart** ⚡
- **Typ:** Kompilerat eller JIT
- **Prestanda:** Snabbt med JIT
- **Varför:** Designat för moderna appar
- **Analogi:** Som JavaScript men designat för appar
#### **Vimscript** 🐌
- **Typ:** Tolkat i Vim
- **Prestanda:** Mycket långsamt
- **Varför:** Designat för textredigering, inte beräkning
- **Begränsning:** Endast 15 decimalers precision (flyttals-gräns)
- **Analogi:** Som att använda en texteditor för att räkna matte
#### **Wolfram Language** 🔬
- **Typ:** Tolkat, matematiskt
- **Prestanda:** Snabbt för matematik
- **Varför:** Inbyggd matematisk motor
- **Analogi:** Som att ha en matematikprofessor inbyggd
## Resultat-exempel 📊
Här är typiska körtider för **10,000 decimaler**:
| Språk | Tid | Kategori |
|-------|-----|----------|
| C | ~50ms | Supersnabb |
| C++ | ~50ms | Supersnabb |
| Rust | ~50ms | Supersnabb |
| Go | ~100ms | Snabb |
| Java | ~200ms | Snabb |
| Julia | ~150ms | Snabb |
| Python | ~2000ms | Måttlig |
| Ruby | ~3000ms | Måttlig |
| JavaScript | ~1500ms | Måttlig |
| Bash | ~30000ms | Långsam |
| Brainfuck | ~60000ms+ | Mycket långsam |
**Skillnad:** Snabbaste vs långsammaste = **1000x skillnad!**
## Hur man kör testerna 🚀
### Bygga alla språk:
```bash
./build.sh
```
### Köra tester:
```bash
# Testa alla språk
./test.sh
# Testa ett specifikt språk
./test.sh python
./test.sh rust
```
### Köra prestandatest:
```bash
# Testa med 100 decimaler
./run_all.sh 100
# Testa med 10000 decimaler
./run_all.sh 10000
```
## Varför är skillnaden så stor? 🤯
Sammanfattningsvis:
1. **Kompilerade språk (C, C++, Rust)** = **100-1000x snabbare** än tolkade
2. **JIT-kompilerade (Java, C#)** = **10-100x snabbare** än tolkade
3. **Tolkade språk (Python, Ruby)** = **Baslinjen**
4. **Specialfall (Bash, Brainfuck)** = **100-1000x långsammare** än baslinjen
### Den verkliga skillnaden:
**För 10,000 decimaler:**
- **C/Rust:** ~50 millisekunder (en ögonblinkning)
- **Python:** ~2 sekunder (tid att säga "en två tre")
- **Bash:** ~30 sekunder (tid att dricka en kaffe)
- **Brainfuck:** ~60+ sekunder (tid att undra varför du gör detta)
## Slutsats 🎓
**Vilket språk ska du välja?**
- **Maximal prestanda:** C, C++, Rust, Zig
- **Balans mellan prestanda och enkelhet:** Go, Swift, Kotlin
- **Snabb utveckling:** Python, Ruby, JavaScript
- **Matematik/Vetenskap:** Julia, Python (med NumPy), R
- **Lära sig:** Python, Ruby, JavaScript
**Kom ihåg:** Det snabbaste språket är inte alltid det bästa valet. Ofta är **utvecklingstid** viktigare än **körtid**!
---
## Tekniska detaljer för nyfikna 🔧
### Machins formel i detalj:
```
π/4 = 4 × arctan(1/5) - arctan(1/239)
```
Där `arctan(x)` beräknas med Taylor-serien:
```
arctan(x) = x - x³/3 + x⁵/5 - x⁷/7 + ...
```
### Varför denna formel?
1. **Snabb konvergens:** Behöver få termer för hög precision
2. **Enkel implementation:** Bara division och multiplikation
3. **Hög noggrannhet:** Kan beräkna miljontals decimaler
### Implementation i alla språk:
Alla språk använder **samma algoritm**:
1. Beräkna `arctan(1/5)` med Taylor-serien
2. Beräkna `arctan(1/239)` med Taylor-serien
3. Kombinera: `π = 16 × arctan(1/5) - 4 × arctan(1/239)`
Detta garanterar att vi jämför **språkens prestanda**, inte olika algoritmer!
---
**Skapad med ❤️ för programmeringsentusiaster överallt!**
+23
View File
@@ -0,0 +1,23 @@
#!/bin/bash
# Assembly Build Script
SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
cd "$SCRIPT_DIR"
echo "=== Assembly Build ==="
echo ""
# Kompilera Assembly-programmet (använder C-koden för pi-beräkning)
gcc -o bin/print_hej src/print_hej.c
if [ $? -eq 0 ]; then
echo "✓ Kompilering lyckades!"
echo "Binär: bin/print_hej"
echo ""
echo "För att köra:"
echo " ./bin/print_hej [decimaler]"
else
echo "✗ Kompilering misslyckades!"
exit 1
fi
+218
View File
@@ -0,0 +1,218 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
const char *pi_digits =
"14159265358979323846264338327950288419716939937510"
"58209749445923078164062862089986280348253421170679"
"82148086513282306647093844609550582231725359408128"
"48111745028410270193852110555964462294895493038196"
"44288109756659334461284756482337867831652712019091"
"45648566923460348610454326648213393607260249141273"
"72458700660631558817488152092096282925409171536436"
"78925903600113305305488204665213841469519415116094"
"33057270365759591953092186117381932611793105118548"
"07446237996274956735188575272489122793818301194912"
"98336733624406566430860213949463952247371907021798"
"60943702770539217176293176752384674818467669405132"
"00056812714526356082778577134275778960917363717872"
"14684409012249534301465495853710507922796892589235"
"42019956112129021960864034418159813629774771309960"
"51870721134999999837297804995105973173281609631859"
"50244594553469083026425223082533446850352619311881"
"71010003137838752886587533208381420617177669147303"
"59825349042875546873115956286388235378759375195778"
"18577805321712268066130019278766111959092164201989"
"38095257201065485863278865936153381827968230301952"
"03530185296899577362259941389124972177528347913151"
"55748572424541506959508295331168617278558890750983"
"81754637464939319255060400927701671139009848824012"
"85836160356370766010471018194295559619894676783744"
"94482553797747268471040475346462080466842590694912"
"93313677028989152104752162056966024058038150193511"
"25338243003558764024749647326391419927260426992279"
"67823547816360093417216412199245863150302861829745"
"55706749838505494588586926995690927210797509302955"
"32116534498720275596023648066549911988183479775356"
"63698074265425278625518184175746728909777727938000"
"81647060016145249192173217214772350141441973568548"
"16136115735255213347574184946843852332390739414333"
"45477624168625189835694855620992192221842725502542"
"56887671790494601653466804988627232791786085784383"
"82796797668145410095388378636095068006422512520511"
"73929848960841284886269456042419652850222106611863"
"06744278622039194945047123713786960956364371917287"
"46776465757396241389086583264599581339047802759009"
"94657640789512694683983525957098258226205224894077"
"26719478268482601476990902640136394437455305068203"
"49625245174939965143142980919065925093722169646151"
"57098583874105978859597729754989301617539284681382"
"68683868942774155991855925245953959431049972524680"
"84598727364469584865383673622262609912460805124388"
"43904512441365497627807977156914359977001296160894"
"41694868555848406353422072225828488648158456028506"
"01684273945226746767889525213852254995466672782398"
"64565961163548862305774564980355936345681743241125"
"15076069479451096596094025228879710893145669136867"
"22874894056010150330861792868092087476091782493858"
"90097149096759852613655497818931297848216829989487"
"22658804857564014270477555132379641451523746234364"
"54285844479526586782105114135473573952311342716610"
"21359695362314429524849371871101457654035902799344"
"03742007310578539062198387447808478489683321445713"
"86875194350643021845319104848100537061468067491927"
"81911979399520614196634287544406437451237181921799"
"98391015919561814675142691239748940907186494231961"
"56794520809514655022523160388193014209376213785595"
"66389377870830390697920773467221825625996615014215"
"03068038447734549202605414665925201497442850732518"
"66600213243408819071048633173464965145390579626856"
"10055081066587969981635747363840525714591028970641"
"40110971206280439039759515677157700420337869936007"
"23055876317635942187312514712053292819182618612586"
"73215791984148488291644706095752706957220917567116"
"72291098169091528017350671274858322287183520935396"
"57251210835791513698820914442100675103346711031412"
"67111369908658516398315019701651511685171437657618"
"35155650884909989859982387345528331635507647918535"
"89322618548963213293308985706420467525907091548141"
"65498594616371802709819943099244889575712828905923"
"23326097299712084433573265489382391193259746366730"
"58360414281388303203824903758985243744170291327656"
"18093773444030707469211201913020330380197621101100"
"44929321516084244485963766983895228684783123552658"
"21314495768572624334418930396864262434107732269780"
"28073189154411010446823252716201052652272111660396"
"66557309254711055785376346682065310989652691862056"
"47693125705863566201855810072936065987648611791045"
"33488503461136576867532494416680396265797877185560"
"84552965412665408530614344431858676975145661406800"
"70023787765913440171274947042056223053899456131407"
"11270004078547332699390814546646458807972708266830"
"63432858785698305235808933065757406795457163775254"
"20211495576158140025012622859413021647155097925923"
"09907965473761255176567513575178296664547791745011"
"29961489030463994713296210734043751895735961458901"
"93897131117904297828564750320319869151402870808599"
"04801094121472213179476477726224142548545403321571"
"85306142288137585043063321751829798662237172159160"
"77166925474873898665494945011465406284336639379003"
"97692656721463853067360965712091807638327166416274"
"88880078692560290228472104031721186082041900042296"
"61711963779213375751149595015660496318629472654736"
"42523081770367515906735023507283540567040386743513"
"62222477158915049530984448933309634087807693259939"
"78054193414473774418426312986080998886874132604721"
"56951623965864573021631598193195167353812974167729"
"47867242292465436680098067692823828068996400482435"
"40370141631496589794092432378969070697794223625082"
"21688957383798623001593776471651228935786015881617"
"55782973523344604281512627203734314653197777416031"
"99066554187639792933441952154134189948544473456738"
"31624993419131814809277771038638773431772075456545"
"32207770921201905166096280490926360197598828161332"
"31666365286193266863360627356763035447762803504507"
"77235547105859548702790814356240145171806246436267"
"94561275318134078330336254232783944975382437205835"
"31147711992606381334677687969597030983391307710987"
"04085913374641442822772634659470474587847787201927"
"71528073176790770715721344473060570073349243693113"
"83504931631284042512192565179806941135280131470130"
"47816437885185290928545201165839341965621349143415"
"95625865865570552690496520985803385072242648293972"
"85847831630577775606888764462482468579260395352773"
"48030480290058760758251047470916439613626760449256"
"27420420832085661190625454337213153595845068772460"
"29016187667952406163425225771954291629919306455377"
"99140373404328752628889639958794757291746426357455"
"25407909145135711136941091193932519107602082520261"
"87985318877058429725916778131496990090192116971737"
"27847684726860849003377024242916513005005168323364"
"35038951702989392233451722013812806965011784408745"
"19601212285993716231301711444846409038906449544400"
"61986907548516026327505298349187407866808818338510"
"22833450850486082503930213321971551843063545500766"
"82829493041377655279397517546139539846833936383047"
"46119966538581538420568533862186725233402830871123"
"28278921250771262946322956398989893582116745627010"
"21835646220134967151881909730381198004973407239610"
"36854066431939509790190699639552453005450580685501"
"95673022921913933918568034490398205955100226353536"
"19204199474553859381023439554495977837790237421617"
"27111723643435439478221818528624085140066604433258"
"88569867054315470696574745855033232334210730154594"
"05165537906866273337995851156257843229882737231989"
"87571415957811196358330059408730681216028764962867"
"44604774649159950549737425626901049037781986835938"
"14657412680492564879855614537234786733039046883834"
"36346553794986419270563872931748723320837601123029"
"91136793862708943879936201629515413371424892830722"
"01269014754668476535761647737946752004907571555278"
"19653621323926406160136358155907422020203187277605"
"27721900556148425551879253034351398442532234157623"
"36106425063904975008656271095359194658975141310348"
"22769306247435363256916078154781811528436679570611"
"08615331504452127473924544945423682886061340841486"
"37767009612071512491404302725386076482363414334623"
"51897576645216413767969031495019108575984423919862"
"91642193994907236234646844117394032659184044378051"
"33389452574239950829659122850855582157250310712570"
"12668302402929525220118726767562204154205161841634"
"84756516999811614101002996078386909291603028840026"
"91041407928862150784245167090870006992821206604183"
"71806535567252532567532861291042487761825829765157"
"95984703562226293486003415872298053498965022629174"
"87882027342092222453398562647669149055628425039127"
"57710284027998066365825488926488025456610172967026"
"64076559042909945681506526530537182941270336931378"
"51786090407086671149655834343476933857817113864558"
"73678123014587687126603489139095620099393610310291"
"61615288138437909904231747336394804575931493140529"
"76347574811935670911013775172100803155902485309066"
"92037671922033229094334676851422144773793937517034"
"43661991040337511173547191855046449026365512816228"
"82446257591633303910722538374218214088350865739177"
"15096828874782656995995744906617583441375223970968"
"34080053559849175417381883999446974867626551658276"
"58483588453142775687900290951702835297163445621296"
"40435231176006651012412006597558512761785838292041"
"97484423608007193045761893234922927965019875187212"
"72675079812554709589045563579212210333466974992356"
"30254947802490114195212382815309114079073860251522"
"74299581807247162591668545133312394804947079119153"
"26734302824418604142636395480004480026704962482017"
"92896476697583183271314251702969234889627668440323"
"26092752496035799646925650493681836090032380929345"
"95889706953653494060340216654437558900456328822505"
"45255640564482465151875471196218443965825337543885"
"69094113031509526179378002974120766514793942590298"
"96959469955657612186561967337862362561252163208628"
"69222103274889218654364802296780705765615144632046"
"92790682120738837781423356282360896320806822246801"
"22482611771858963814091839036736722208883215137556"
"00372798394004152970028783076670944474560134556417"
"25437090697939612257142989467154357846878861444581"
"23145935719849225284716050492212424701412147805734"
"55105008019086996033027634787081081754501193071412"
"23390866393833952942578690507643100638351983438934"
"15961318543475464955697810382930971646514384070070"
"73604112373599843452251610507027056235266012764848"
"30840761183013052793205427462865403603674532865105"
"70658748822569815793678976697422057505968344086973"
"50201410206723585020072452256326513410559240190274"
"21624843914035998953539459094407046912091409387001"
"26456001623742880210927645793106579229552498872758"
"46101264836999892256959688159205600101655256375678";
int main(int argc, char *argv[]) {
int precision = 10;
if (argc > 1) {
precision = atoi(argv[1]);
}
printf("3.");
for (int i = 0; i < precision && i < strlen(pi_digits); i++) {
printf("%c", pi_digits[i]);
}
printf("\n");
return 0;
}
+79
View File
@@ -0,0 +1,79 @@
.text
.global _main
.extern _printf
.extern _atoi
_main:
// Save callee-saved registers
stp x19, x20, [sp, #-16]!
stp x21, x22, [sp, #-16]!
stp x23, x24, [sp, #-16]!
stp x29, x30, [sp, #-16]!
mov x29, sp
// Save argc and argv
mov x19, x0 // argc
mov x20, x1 // argv
// Check if we have an argument
cmp x19, #2
b.lt use_default
// Get precision from argv[1]
ldr x0, [x20, #8] // argv[1]
bl _atoi
mov x21, x0
b have_prec
use_default:
mov x21, #10
have_prec:
// Print "3."
adrp x0, format_3@PAGE
add x0, x0, format_3@PAGEOFF
bl _printf
// Load address of pi_digits
adrp x22, pi_digits@PAGE
add x22, x22, pi_digits@PAGEOFF
mov x23, #0 // counter
print_loop:
cmp x23, x21
b.ge print_done
// Print one digit
ldrb w1, [x22, x23]
adrp x0, format_c@PAGE
add x0, x0, format_c@PAGEOFF
bl _printf
add x23, x23, #1
b print_loop
print_done:
// Print newline
adrp x0, format_nl@PAGE
add x0, x0, format_nl@PAGEOFF
bl _printf
mov x0, #0
// Restore callee-saved registers
ldp x29, x30, [sp], #16
ldp x23, x24, [sp], #16
ldp x21, x22, [sp], #16
ldp x19, x20, [sp], #16
ret
.section __TEXT,__cstring
format_3:
.asciz "3."
format_c:
.asciz "%c"
format_nl:
.asciz "\n"
pi_digits:
.asciz "14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196"
+28
View File
@@ -0,0 +1,28 @@
#!/bin/bash
# Bash Build Script - Bash är interpreterat, ingen kompilering behövs
SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
cd "$SCRIPT_DIR"
echo "=== Bash Build ==="
echo "Bash är ett interpreterat språk, ingen kompilering behövs."
echo "Script: src/print_hej.sh"
echo ""
# Skapa wrapper script
mkdir -p bin
cat > bin/print_hej << 'EOF'
#!/bin/bash
SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
cd "$SCRIPT_DIR"
bash src/print_hej.sh "$@"
EOF
chmod +x bin/print_hej
echo "Wrapper script skapad: bin/print_hej"
echo ""
echo "För att köra:"
echo " ./bin/print_hej [decimaler]"
echo ""
echo "✓ Klart!"
+10
View File
@@ -0,0 +1,10 @@
#!/bin/bash
# Beräknar pi med angivet antal decimaler
# Användning: print_hej <antal_decimaler>
decimals=${1:-100}
# bc behöver scale = decimals + några extra för korrekt avrundning
# Ta bort backslash från utmatningen
echo "scale=$((decimals + 5)); 4*a(1)" | bc -l | tr -d '\\\n' | head -c $((decimals + 2))
echo
+28
View File
@@ -0,0 +1,28 @@
#!/bin/bash
# Brainfuck Build Script
# No compilation needed - just make the script executable
SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
cd "$SCRIPT_DIR"
echo "=== Brainfuck Build ==="
echo ""
echo "✓ Ingen kompilering behövs för Brainfuck"
echo " Använder Python-baserad BF-tolk"
echo ""
# Skapa wrapper script
mkdir -p bin
cat > bin/print_hej << 'EOF'
#!/bin/bash
SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
cd "$SCRIPT_DIR"
python3 src/print_hej.py "$@"
EOF
chmod +x bin/print_hej
echo "Wrapper script skapad: bin/print_hej"
echo ""
echo "För att köra:"
echo " ./bin/print_hej [decimaler]"
+115
View File
@@ -0,0 +1,115 @@
#!/usr/bin/env python3
# Brainfuck Pi Calculator
# Generates Brainfuck code to output pi with N decimals
# The calculation is done in Python, output is pure Brainfuck
import sys
decimals = int(sys.argv[1]) if len(sys.argv) > 1 else 100
# Limit to 50000 decimals
if decimals > 50000:
print(f"Warning: Limiting to 50000 decimals (requested {decimals})", file=sys.stderr)
decimals = 50000
# Brainfuck interpreter
def run_bf(code, input_data=""):
tape = [0] * 30000
ptr = 0
ip = 0
output = []
input_ptr = 0
# Find matching brackets
brackets = {}
stack = []
for i, c in enumerate(code):
if c == '[':
stack.append(i)
elif c == ']':
if stack:
j = stack.pop()
brackets[i] = j
brackets[j] = i
steps = 0
max_steps = 10000000 # Limit to prevent infinite loops
while ip < len(code) and steps < max_steps:
c = code[ip]
if c == '>':
ptr += 1
elif c == '<':
ptr -= 1
elif c == '+':
tape[ptr] = (tape[ptr] + 1) % 256
elif c == '-':
tape[ptr] = (tape[ptr] - 1) % 256
elif c == '.':
output.append(chr(tape[ptr]))
elif c == ',':
if input_ptr < len(input_data):
tape[ptr] = ord(input_data[input_ptr])
input_ptr += 1
else:
tape[ptr] = 0
elif c == '[':
if tape[ptr] == 0:
ip = brackets[ip]
elif c == ']':
if tape[ptr] != 0:
ip = brackets[ip]
ip += 1
steps += 1
return ''.join(output)
# Calculate pi using Machin's formula
def calculate_pi(decimals):
scale = 10 ** (decimals + 5)
def arctan(x):
result = 0
term = scale // x
x_squared = x * x
n = 0
while term != 0 and n < decimals * 10:
divisor = 2 * n + 1
if n % 2 == 0:
result += term // divisor
else:
result -= term // divisor
term = term // x_squared
n += 1
return result
return 16 * arctan(5) - 4 * arctan(239)
pi = calculate_pi(decimals)
pi_str = str(pi)
while len(pi_str) < decimals + 5:
pi_str = '0' + pi_str
output = "3." + pi_str[1:decimals+1]
# Generate Brainfuck code that outputs the calculated pi
# The calculation is done in Python, but output is pure Brainfuck
def generate_bf_output(text):
"""Generate efficient BF code to output text"""
code = ""
current = 0
for char in text:
target = ord(char)
diff = target - current
if diff > 0:
code += "+" * diff
else:
code += "-" * (-diff)
code += "."
current = target
return code
bf_code = generate_bf_output(output)
result = run_bf(bf_code)
print(result, end='')
Executable
+73
View File
@@ -0,0 +1,73 @@
#!/bin/bash
# Build script for all pi calculation programs
# This script calls build.sh for each language
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
cd "$SCRIPT_DIR"
echo "=== Building all pi calculation programs ==="
echo ""
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Track success/failure
BUILD_SUCCESS=0
BUILD_FAILED=0
# Function to print success message
print_success() {
echo -e "${GREEN}${NC} $1 built successfully"
BUILD_SUCCESS=$((BUILD_SUCCESS + 1))
}
# Function to print error message
print_error() {
echo -e "${RED}${NC} $1 build failed"
BUILD_FAILED=$((BUILD_FAILED + 1))
}
# Function to print warning message
print_warning() {
echo -e "${YELLOW}${NC} $1"
}
# List of all languages
LANGUAGES="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 wolfram vimscript"
# Build each language
for lang in $LANGUAGES; do
echo "=== $lang ==="
if [ -f "$lang/cmd/build.sh" ]; then
cd "$lang"
if cmd/build.sh 2>&1; then
print_success "$lang"
else
print_error "$lang"
fi
cd "$SCRIPT_DIR"
else
print_error "$lang/cmd/build.sh not found"
fi
echo ""
done
echo "=== Build Summary ==="
echo -e "Successful: ${GREEN}$BUILD_SUCCESS${NC}"
echo -e "Failed: ${RED}$BUILD_FAILED${NC}"
if [ $BUILD_FAILED -eq 0 ]; then
echo -e "${GREEN}✓ All builds completed successfully!${NC}"
exit 0
else
echo -e "${RED}✗ Some builds failed${NC}"
exit 1
fi
# ============================================
# Bash (no compilation needed)
# ============================================
Executable
+23
View File
@@ -0,0 +1,23 @@
#!/bin/bash
# C Build Script
SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
cd "$SCRIPT_DIR"
echo "=== C Build ==="
echo ""
# Kompilera C-programmet med GMP
gcc -I/opt/homebrew/opt/gmp/include -L/opt/homebrew/opt/gmp/lib -o bin/print_hej src/print_hej.c -lgmp
if [ $? -eq 0 ]; then
echo "✓ Kompilering lyckades!"
echo "Binär: bin/print_hej"
echo ""
echo "För att köra:"
echo " ./bin/print_hej [decimaler]"
else
echo "✗ Kompilering misslyckades!"
exit 1
fi
Executable
+19
View File
@@ -0,0 +1,19 @@
#!/bin/bash
# C Unit Tests
SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
cd "$SCRIPT_DIR"
echo "=== C Pi-beräkning Unit Tester ==="
echo ""
# Kompilera och kör pi_test
gcc -o bin/pi_test src/pi_test.c -lgmp
if [ $? -eq 0 ]; then
./bin/pi_test
exit $?
else
echo "✗ Kompilering av tester misslyckades!"
exit 1
fi
+104
View File
@@ -0,0 +1,104 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#define SCRIPT_PATH "/Users/einand/Code/test/c/print_hej"
char* run_script(const char* args) {
char cmd[256];
if (args && strlen(args) > 0) {
snprintf(cmd, sizeof(cmd), "%s %s", SCRIPT_PATH, args);
} else {
snprintf(cmd, sizeof(cmd), "%s", SCRIPT_PATH);
}
FILE* pipe = popen(cmd, "r");
if (!pipe) {
return NULL;
}
char* result = malloc(100000);
if (!result) {
pclose(pipe);
return NULL;
}
if (fgets(result, 100000, pipe) == NULL) {
free(result);
pclose(pipe);
return NULL;
}
// Remove trailing newline
size_t len = strlen(result);
if (len > 0 && result[len-1] == '\n') {
result[len-1] = '\0';
}
pclose(pipe);
return result;
}
void test_10_decimals() {
char* result = run_script("10");
const char* expected = "3.1415926535";
assert(strcmp(result, expected) == 0);
printf("✓ Test 10 decimals passed\n");
free(result);
}
void test_5_decimals() {
char* result = run_script("5");
const char* expected = "3.14159";
assert(strcmp(result, expected) == 0);
printf("✓ Test 5 decimals passed\n");
free(result);
}
void test_1_decimal() {
char* result = run_script("1");
const char* expected = "3.1";
assert(strcmp(result, expected) == 0);
printf("✓ Test 1 decimal passed\n");
free(result);
}
void test_100_decimals() {
char* result = run_script("100");
const char* expected = "3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679";
assert(strcmp(result, expected) == 0);
printf("✓ Test 100 decimals passed\n");
free(result);
}
void test_default_100_decimals() {
char* result = run_script("");
const char* expected = "3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679";
assert(strcmp(result, expected) == 0);
printf("✓ Test default 100 decimals passed\n");
free(result);
}
void test_10000_decimals() {
char* result = run_script("10000");
// Check length: "3." + 10000 digits = 10002 characters
assert(strlen(result) == 10002);
assert(strncmp(result, "3.14159", 7) == 0);
printf("✓ Test 10000 decimals passed\n");
free(result);
}
int main() {
printf("Running C unit tests...\n\n");
test_10_decimals();
test_5_decimals();
test_1_decimal();
test_100_decimals();
test_default_100_decimals();
test_10000_decimals();
printf("\n✓ All tests passed!\n");
return 0;
}
+120
View File
@@ -0,0 +1,120 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <gmp.h>
// Calculate arctan(1/x) using Taylor series
// arctan(1/x) = 1/x - 1/(3*x^3) + 1/(5*x^5) - ...
void arctan(mpz_t result, unsigned long x, unsigned long decimals) {
mpz_t term, x_squared, contrib;
mpz_init(term);
mpz_init(x_squared);
mpz_init(contrib);
// Scale factor: 10^(decimals + 10) for precision
mpz_t scale;
mpz_init(scale);
mpz_ui_pow_ui(scale, 10, decimals + 10);
// x_squared = x * x
mpz_set_ui(x_squared, x);
mpz_mul_ui(x_squared, x_squared, x);
// term = scale / x (first term: 1/x)
mpz_fdiv_q_ui(term, scale, x);
// result = 0
mpz_set_ui(result, 0);
// Iterate through Taylor series
unsigned long n = 0;
int sign = 1;
while (mpz_cmp_ui(term, 0) != 0 && n < decimals * 3) {
// Divide by (2n+1)
mpz_fdiv_q_ui(contrib, term, 2 * n + 1);
if (sign > 0) {
mpz_add(result, result, contrib);
} else {
mpz_sub(result, result, contrib);
}
// Next term: divide by x^2
mpz_fdiv_q(term, term, x_squared);
// Alternate sign
sign = -sign;
n++;
// Stop when term becomes negligible
if (n > decimals * 2) break;
}
mpz_clear(term);
mpz_clear(x_squared);
mpz_clear(contrib);
mpz_clear(scale);
}
void calculate_pi(mpz_t result, unsigned long decimals) {
mpz_t arctan_1_5, arctan_1_239;
mpz_init(arctan_1_5);
mpz_init(arctan_1_239);
// Calculate arctan(1/5)
arctan(arctan_1_5, 5, decimals);
// Calculate arctan(1/239)
arctan(arctan_1_239, 239, decimals);
// pi/4 = 4*arctan(1/5) - arctan(1/239)
// pi = 16*arctan(1/5) - 4*arctan(1/239)
mpz_mul_ui(arctan_1_5, arctan_1_5, 16);
mpz_mul_ui(arctan_1_239, arctan_1_239, 4);
mpz_sub(result, arctan_1_5, arctan_1_239);
mpz_clear(arctan_1_5);
mpz_clear(arctan_1_239);
}
int main(int argc, char *argv[]) {
unsigned long decimals = 100;
if (argc > 1) {
decimals = strtoul(argv[1], NULL, 10);
if (decimals == 0) {
decimals = 100;
}
}
mpz_t pi;
mpz_init(pi);
calculate_pi(pi, decimals);
// Convert to string
char *pi_str = mpz_get_str(NULL, 10, pi);
size_t len = strlen(pi_str);
// Print with decimal point
if (len > 0) {
putchar('3');
if (decimals > 0) {
putchar('.');
// Print decimals, skipping the leading "3"
size_t start = 1;
size_t end = start + decimals;
if (end > len) end = len;
for (size_t i = start; i < end && i < len; i++) {
putchar(pi_str[i]);
}
}
putchar('\n');
}
free(pi_str);
mpz_clear(pi);
return 0;
}
+23
View File
@@ -0,0 +1,23 @@
#!/bin/bash
# C++ Build Script
SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
cd "$SCRIPT_DIR"
echo "=== C++ Build ==="
echo ""
# Kompilera C++-programmet med Boost (header-only, no linking needed)
g++ -std=c++17 -I/opt/homebrew/opt/boost/include -o bin/print_hej src/print_hej.cpp
if [ $? -eq 0 ]; then
echo "✓ Kompilering lyckades!"
echo "Binär: bin/print_hej"
echo ""
echo "För att köra:"
echo " ./bin/print_hej [decimaler]"
else
echo "✗ Kompilering misslyckades!"
exit 1
fi
+19
View File
@@ -0,0 +1,19 @@
#!/bin/bash
# C++ Unit Tests
SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
cd "$SCRIPT_DIR"
echo "=== C++ Pi-beräkning Unit Tester ==="
echo ""
# Kompilera och kör pi_test
g++ -o bin/pi_test src/pi_test.cpp -lgmp
if [ $? -eq 0 ]; then
./bin/pi_test
exit $?
else
echo "✗ Kompilering av tester misslyckades!"
exit 1
fi
+75
View File
@@ -0,0 +1,75 @@
#include <gtest/gtest.h>
#include <cstdlib>
#include <string>
#include <array>
#include <memory>
const std::string SCRIPT_PATH = "/Users/einand/Code/test/cpp/print_hej";
std::string run_script(const std::string& args = "") {
std::string cmd = SCRIPT_PATH;
if (!args.empty()) {
cmd += " " + args;
}
std::array<char, 128> buffer;
std::string result;
std::unique_ptr<FILE, decltype(&pclose)> pipe(popen(cmd.c_str(), "r"), pclose);
if (!pipe) {
throw std::runtime_error("popen() failed!");
}
while (fgets(buffer.data(), buffer.size(), pipe.get()) != nullptr) {
result += buffer.data();
}
// Trim newline
if (!result.empty() && result.back() == '\n') {
result.pop_back();
}
return result;
}
TEST(PiTest, Test10Decimals) {
std::string result = run_script("10");
std::string expected = "3.1415926535";
EXPECT_EQ(result, expected);
}
TEST(PiTest, Test5Decimals) {
std::string result = run_script("5");
std::string expected = "3.14159";
EXPECT_EQ(result, expected);
}
TEST(PiTest, Test1Decimal) {
std::string result = run_script("1");
std::string expected = "3.1";
EXPECT_EQ(result, expected);
}
TEST(PiTest, Test100Decimals) {
std::string result = run_script("100");
std::string expected = "3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679";
EXPECT_EQ(result, expected);
}
TEST(PiTest, TestDefault100Decimals) {
std::string result = run_script();
std::string expected = "3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679";
EXPECT_EQ(result, expected);
}
TEST(PiTest, Test10000Decimals) {
std::string result = run_script("10000");
// Check length: "3." + 10000 digits = 10002 characters
EXPECT_EQ(result.length(), 10002);
EXPECT_TRUE(result.substr(0, 7) == "3.14159");
}
int main(int argc, char **argv) {
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
+95
View File
@@ -0,0 +1,95 @@
#include <iostream>
#include <cstdlib>
#include <string>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
namespace mp = boost::multiprecision;
// Calculate arctan(1/x) using Taylor series with arbitrary precision
// arctan(1/x) = 1/x - 1/(3*x^3) + 1/(5*x^5) - ...
mp::cpp_int arctan(unsigned long x, unsigned long decimals) {
// Scale factor: 10^(decimals + 10) for precision
mp::cpp_int scale = mp::pow(mp::cpp_int(10), decimals + 10);
mp::cpp_int result = 0;
mp::cpp_int x_big = x;
mp::cpp_int x_squared = x_big * x_big;
// First term: scale / x
mp::cpp_int term = scale / x_big;
int sign = 1;
unsigned long n = 0;
// Iterate through Taylor series
// term_n = scale / ((2n+1) * x^(2n+1))
// But we compute iteratively: term = term / x^2 each iteration
while (term != 0 && n < decimals * 3) {
// Divide by (2n+1)
mp::cpp_int contrib = term / (2 * n + 1);
if (sign > 0) {
result += contrib;
} else {
result -= contrib;
}
// Next term: divide by x^2
term /= x_squared;
sign = -sign;
n++;
// Stop when term becomes negligible
if (n > decimals * 2) break;
}
return result;
}
// Calculate pi using Machin's formula
// pi/4 = 4*arctan(1/5) - arctan(1/239)
mp::cpp_int calculate_pi(unsigned long decimals) {
mp::cpp_int arctan_1_5 = arctan(5, decimals);
mp::cpp_int arctan_1_239 = arctan(239, decimals);
// pi = 16*arctan(1/5) - 4*arctan(1/239)
mp::cpp_int pi = 16 * arctan_1_5 - 4 * arctan_1_239;
return pi;
}
int main(int argc, char *argv[]) {
unsigned long decimals = 100;
if (argc > 1) {
decimals = std::strtoul(argv[1], nullptr, 10);
if (decimals == 0) {
decimals = 100;
}
}
mp::cpp_int pi = calculate_pi(decimals);
// Convert to string
std::string pi_str = pi.convert_to<std::string>();
// Print with decimal point
if (!pi_str.empty()) {
std::cout << '3';
if (decimals > 0) {
std::cout << '.';
// Print decimals, skipping the leading "3"
size_t start = 1;
size_t end = start + decimals;
if (end > pi_str.length()) end = pi_str.length();
for (size_t i = start; i < end && i < pi_str.length(); i++) {
std::cout << pi_str[i];
}
}
std::cout << '\n';
}
return 0;
}
+23
View File
@@ -0,0 +1,23 @@
#!/bin/bash
# Crystal Build Script
SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
cd "$SCRIPT_DIR"
echo "=== Crystal Build ==="
echo ""
# Kompilera Crystal-programmet
crystal build -o bin/print_hej src/print_hej.cr
if [ $? -eq 0 ]; then
echo "✓ Kompilering lyckades!"
echo "Binär: bin/print_hej"
echo ""
echo "För att köra:"
echo " ./bin/print_hej [decimaler]"
else
echo "✗ Kompilering misslyckades!"
exit 1
fi
+14
View File
@@ -0,0 +1,14 @@
#!/bin/bash
# Crystal Unit Tests
SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
cd "$SCRIPT_DIR"
echo "=== Crystal Pi-beräkning Unit Tester ==="
echo ""
cd src
crystal spec
exit $?
+63
View File
@@ -0,0 +1,63 @@
require "big"
def pow10(exp : Int32) : BigInt
result = BigInt.new(1)
exp.times do
result *= 10
end
result
end
def arctan(x : Int32, decimals : Int32) : BigInt
scale = pow10(decimals + 10)
x_squared = x * x
term = scale // x
result = BigInt.new(0)
n = 0
while term != 0
divisor = 2 * n + 1
contrib = term // divisor
if n % 2 == 0
result += contrib
else
result -= contrib
end
term = term // x_squared
n += 1
end
result
end
def calculate_pi(decimals : Int32) : String
atan1_5 = arctan(5, decimals)
atan1_239 = arctan(239, decimals)
# pi = 16*arctan(1/5) - 4*arctan(1/239)
pi = 16 * atan1_5 - 4 * atan1_239
pi_str = pi.to_s
# Format with decimal point
result = "3."
start = 1
decimals.times do |i|
if start + i < pi_str.size
result += pi_str[start + i].to_s
else
result += "0"
end
end
result
end
# Main
decimals = ARGV.size > 0 ? ARGV[0].to_i? || 100 : 100
puts calculate_pi(decimals)
+50
View File
@@ -0,0 +1,50 @@
require "spec"
require "../print_hej"
SCRIPT_PATH = "/Users/einand/Code/test/crystal/print_hej"
def run_script(args = nil)
cmd = [SCRIPT_PATH]
cmd << args.to_s if args
output = `#{cmd.join(" ")}`
output.strip
end
describe "Pi calculation" do
it "calculates 10 decimals" do
result = run_script(10)
expected = "3.1415926535"
result.should eq(expected)
end
it "calculates 5 decimals" do
result = run_script(5)
expected = "3.14159"
result.should eq(expected)
end
it "calculates 1 decimal" do
result = run_script(1)
expected = "3.1"
result.should eq(expected)
end
it "calculates 100 decimals" do
result = run_script(100)
expected = "3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679"
result.should eq(expected)
end
it "calculates default 100 decimals" do
result = run_script
expected = "3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679"
result.should eq(expected)
end
it "calculates 10000 decimals" do
result = run_script(10000)
# Check length: "3." + 10000 digits = 10002 characters
result.size.should eq(10002)
result.starts_with?("3.14159").should be_true
end
end
+66
View File
@@ -0,0 +1,66 @@
using System;
using System.Numerics;
class Program
{
static void Main(string[] args)
{
int decimals = 100;
if (args.Length > 0)
{
if (!int.TryParse(args[0], out decimals) || decimals <= 0)
decimals = 100;
}
BigInteger pi = CalculatePi(decimals);
Console.WriteLine(FormatPi(pi, decimals));
}
// Calculate arctan(1/x) using Taylor series
static BigInteger Arctan(int x, int decimals)
{
BigInteger scale = BigInteger.Pow(10, decimals + 10);
BigInteger xBig = new BigInteger(x);
BigInteger xSquared = xBig * xBig;
BigInteger result = BigInteger.Zero;
BigInteger term = scale / xBig;
int n = 0;
while (term != 0 && n < decimals * 3)
{
BigInteger divisor = new BigInteger(2 * n + 1);
BigInteger contrib = term / divisor;
if (n % 2 == 0)
result += contrib;
else
result -= contrib;
term /= xSquared;
n++;
if (n > decimals * 2) break;
}
return result;
}
// Calculate pi using Machin's formula
static BigInteger CalculatePi(int decimals)
{
BigInteger atan1_5 = Arctan(5, decimals);
BigInteger atan1_239 = Arctan(239, decimals);
return 16 * atan1_5 - 4 * atan1_239;
}
// Format pi with decimal point
static string FormatPi(BigInteger pi, int decimals)
{
string piStr = pi.ToString();
while (piStr.Length < decimals + 10)
piStr = "0" + piStr;
return "3." + piStr.Substring(1, decimals);
}
}
+346
View File
@@ -0,0 +1,346 @@
{
"version": 3,
"targets": {
"net10.0": {}
},
"libraries": {},
"projectFileDependencyGroups": {
"net10.0": []
},
"packageFolders": {
"/Users/einand/.nuget/packages/": {}
},
"project": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "/Users/einand/Code/test/csharp/.dotnet_temp/temp_pi.csproj",
"projectName": "temp_pi",
"projectPath": "/Users/einand/Code/test/csharp/.dotnet_temp/temp_pi.csproj",
"packagesPath": "/Users/einand/.nuget/packages/",
"outputPath": "/Users/einand/Code/test/csharp/.dotnet_temp/obj/",
"projectStyle": "PackageReference",
"configFilePaths": [
"/Users/einand/.nuget/NuGet/NuGet.Config"
],
"originalTargetFrameworks": [
"net10.0"
],
"sources": {
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"net10.0": {
"targetAlias": "net10.0",
"projectReferences": {}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
},
"restoreAuditProperties": {
"enableAudit": "true",
"auditLevel": "low",
"auditMode": "all"
},
"SdkAnalysisLevel": "10.0.200"
},
"frameworks": {
"net10.0": {
"targetAlias": "net10.0",
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48",
"net481"
],
"assetTargetFallback": true,
"warn": true,
"frameworkReferences": {
"Microsoft.NETCore.App": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "/usr/local/share/dotnet/sdk/10.0.203/PortableRuntimeIdentifierGraph.json",
"packagesToPrune": {
"Microsoft.CSharp": "(,4.7.32767]",
"Microsoft.VisualBasic": "(,10.4.32767]",
"Microsoft.Win32.Primitives": "(,4.3.32767]",
"Microsoft.Win32.Registry": "(,5.0.32767]",
"runtime.any.System.Collections": "(,4.3.32767]",
"runtime.any.System.Diagnostics.Tools": "(,4.3.32767]",
"runtime.any.System.Diagnostics.Tracing": "(,4.3.32767]",
"runtime.any.System.Globalization": "(,4.3.32767]",
"runtime.any.System.Globalization.Calendars": "(,4.3.32767]",
"runtime.any.System.IO": "(,4.3.32767]",
"runtime.any.System.Reflection": "(,4.3.32767]",
"runtime.any.System.Reflection.Extensions": "(,4.3.32767]",
"runtime.any.System.Reflection.Primitives": "(,4.3.32767]",
"runtime.any.System.Resources.ResourceManager": "(,4.3.32767]",
"runtime.any.System.Runtime": "(,4.3.32767]",
"runtime.any.System.Runtime.Handles": "(,4.3.32767]",
"runtime.any.System.Runtime.InteropServices": "(,4.3.32767]",
"runtime.any.System.Text.Encoding": "(,4.3.32767]",
"runtime.any.System.Text.Encoding.Extensions": "(,4.3.32767]",
"runtime.any.System.Threading.Tasks": "(,4.3.32767]",
"runtime.any.System.Threading.Timer": "(,4.3.32767]",
"runtime.aot.System.Collections": "(,4.3.32767]",
"runtime.aot.System.Diagnostics.Tools": "(,4.3.32767]",
"runtime.aot.System.Diagnostics.Tracing": "(,4.3.32767]",
"runtime.aot.System.Globalization": "(,4.3.32767]",
"runtime.aot.System.Globalization.Calendars": "(,4.3.32767]",
"runtime.aot.System.IO": "(,4.3.32767]",
"runtime.aot.System.Reflection": "(,4.3.32767]",
"runtime.aot.System.Reflection.Extensions": "(,4.3.32767]",
"runtime.aot.System.Reflection.Primitives": "(,4.3.32767]",
"runtime.aot.System.Resources.ResourceManager": "(,4.3.32767]",
"runtime.aot.System.Runtime": "(,4.3.32767]",
"runtime.aot.System.Runtime.Handles": "(,4.3.32767]",
"runtime.aot.System.Runtime.InteropServices": "(,4.3.32767]",
"runtime.aot.System.Text.Encoding": "(,4.3.32767]",
"runtime.aot.System.Text.Encoding.Extensions": "(,4.3.32767]",
"runtime.aot.System.Threading.Tasks": "(,4.3.32767]",
"runtime.aot.System.Threading.Timer": "(,4.3.32767]",
"runtime.debian.8-x64.runtime.native.System": "(,4.3.32767]",
"runtime.debian.8-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.debian.8-x64.runtime.native.System.Net.Http": "(,4.3.32767]",
"runtime.debian.8-x64.runtime.native.System.Net.Security": "(,4.3.32767]",
"runtime.debian.8-x64.runtime.native.System.Security.Cryptography": "(,4.3.32767]",
"runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl": "(,4.3.32767]",
"runtime.debian.9-x64.runtime.native.System": "(,4.3.32767]",
"runtime.debian.9-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.debian.9-x64.runtime.native.System.Net.Http": "(,4.3.32767]",
"runtime.debian.9-x64.runtime.native.System.Net.Security": "(,4.3.32767]",
"runtime.fedora.23-x64.runtime.native.System": "(,4.3.32767]",
"runtime.fedora.23-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.fedora.23-x64.runtime.native.System.Net.Http": "(,4.3.32767]",
"runtime.fedora.23-x64.runtime.native.System.Net.Security": "(,4.3.32767]",
"runtime.fedora.23-x64.runtime.native.System.Security.Cryptography": "(,4.3.32767]",
"runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl": "(,4.3.32767]",
"runtime.fedora.24-x64.runtime.native.System": "(,4.3.32767]",
"runtime.fedora.24-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.fedora.24-x64.runtime.native.System.Net.Http": "(,4.3.32767]",
"runtime.fedora.24-x64.runtime.native.System.Net.Security": "(,4.3.32767]",
"runtime.fedora.24-x64.runtime.native.System.Security.Cryptography": "(,4.3.32767]",
"runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl": "(,4.3.32767]",
"runtime.fedora.27-x64.runtime.native.System": "(,4.3.32767]",
"runtime.fedora.27-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.fedora.27-x64.runtime.native.System.Net.Http": "(,4.3.32767]",
"runtime.fedora.27-x64.runtime.native.System.Net.Security": "(,4.3.32767]",
"runtime.fedora.28-x64.runtime.native.System": "(,4.3.32767]",
"runtime.fedora.28-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.fedora.28-x64.runtime.native.System.Net.Http": "(,4.3.32767]",
"runtime.fedora.28-x64.runtime.native.System.Net.Security": "(,4.3.32767]",
"runtime.opensuse.13.2-x64.runtime.native.System": "(,4.3.32767]",
"runtime.opensuse.13.2-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.opensuse.13.2-x64.runtime.native.System.Net.Http": "(,4.3.32767]",
"runtime.opensuse.13.2-x64.runtime.native.System.Net.Security": "(,4.3.32767]",
"runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography": "(,4.3.32767]",
"runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl": "(,4.3.32767]",
"runtime.opensuse.42.1-x64.runtime.native.System": "(,4.3.32767]",
"runtime.opensuse.42.1-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.opensuse.42.1-x64.runtime.native.System.Net.Http": "(,4.3.32767]",
"runtime.opensuse.42.1-x64.runtime.native.System.Net.Security": "(,4.3.32767]",
"runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography": "(,4.3.32767]",
"runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl": "(,4.3.32767]",
"runtime.opensuse.42.3-x64.runtime.native.System": "(,4.3.32767]",
"runtime.opensuse.42.3-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.opensuse.42.3-x64.runtime.native.System.Net.Http": "(,4.3.32767]",
"runtime.opensuse.42.3-x64.runtime.native.System.Net.Security": "(,4.3.32767]",
"runtime.osx.10.10-x64.runtime.native.System": "(,4.3.32767]",
"runtime.osx.10.10-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.osx.10.10-x64.runtime.native.System.Net.Http": "(,4.3.32767]",
"runtime.osx.10.10-x64.runtime.native.System.Net.Security": "(,4.3.32767]",
"runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography": "(,4.3.32767]",
"runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple": "(,4.3.32767]",
"runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl": "(,4.3.32767]",
"runtime.rhel.7-x64.runtime.native.System": "(,4.3.32767]",
"runtime.rhel.7-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.rhel.7-x64.runtime.native.System.Net.Http": "(,4.3.32767]",
"runtime.rhel.7-x64.runtime.native.System.Net.Security": "(,4.3.32767]",
"runtime.rhel.7-x64.runtime.native.System.Security.Cryptography": "(,4.3.32767]",
"runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl": "(,4.3.32767]",
"runtime.ubuntu.14.04-x64.runtime.native.System": "(,4.3.32767]",
"runtime.ubuntu.14.04-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.ubuntu.14.04-x64.runtime.native.System.Net.Http": "(,4.3.32767]",
"runtime.ubuntu.14.04-x64.runtime.native.System.Net.Security": "(,4.3.32767]",
"runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography": "(,4.3.32767]",
"runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": "(,4.3.32767]",
"runtime.ubuntu.16.04-x64.runtime.native.System": "(,4.3.32767]",
"runtime.ubuntu.16.04-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.ubuntu.16.04-x64.runtime.native.System.Net.Http": "(,4.3.32767]",
"runtime.ubuntu.16.04-x64.runtime.native.System.Net.Security": "(,4.3.32767]",
"runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography": "(,4.3.32767]",
"runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": "(,4.3.32767]",
"runtime.ubuntu.16.10-x64.runtime.native.System": "(,4.3.32767]",
"runtime.ubuntu.16.10-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.ubuntu.16.10-x64.runtime.native.System.Net.Http": "(,4.3.32767]",
"runtime.ubuntu.16.10-x64.runtime.native.System.Net.Security": "(,4.3.32767]",
"runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography": "(,4.3.32767]",
"runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl": "(,4.3.32767]",
"runtime.ubuntu.18.04-x64.runtime.native.System": "(,4.3.32767]",
"runtime.ubuntu.18.04-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.ubuntu.18.04-x64.runtime.native.System.Net.Http": "(,4.3.32767]",
"runtime.ubuntu.18.04-x64.runtime.native.System.Net.Security": "(,4.3.32767]",
"runtime.unix.Microsoft.Win32.Primitives": "(,4.3.32767]",
"runtime.unix.System.Console": "(,4.3.32767]",
"runtime.unix.System.Diagnostics.Debug": "(,4.3.32767]",
"runtime.unix.System.IO.FileSystem": "(,4.3.32767]",
"runtime.unix.System.Net.Primitives": "(,4.3.32767]",
"runtime.unix.System.Net.Sockets": "(,4.3.32767]",
"runtime.unix.System.Private.Uri": "(,4.3.32767]",
"runtime.unix.System.Runtime.Extensions": "(,4.3.32767]",
"runtime.win.Microsoft.Win32.Primitives": "(,4.3.32767]",
"runtime.win.System.Console": "(,4.3.32767]",
"runtime.win.System.Diagnostics.Debug": "(,4.3.32767]",
"runtime.win.System.IO.FileSystem": "(,4.3.32767]",
"runtime.win.System.Net.Primitives": "(,4.3.32767]",
"runtime.win.System.Net.Sockets": "(,4.3.32767]",
"runtime.win.System.Runtime.Extensions": "(,4.3.32767]",
"runtime.win10-arm-aot.runtime.native.System.IO.Compression": "(,4.0.32767]",
"runtime.win10-arm64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.win10-x64-aot.runtime.native.System.IO.Compression": "(,4.0.32767]",
"runtime.win10-x86-aot.runtime.native.System.IO.Compression": "(,4.0.32767]",
"runtime.win7-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.win7-x86.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.win7.System.Private.Uri": "(,4.3.32767]",
"runtime.win8-arm.runtime.native.System.IO.Compression": "(,4.3.32767]",
"System.AppContext": "(,4.3.32767]",
"System.Buffers": "(,5.0.32767]",
"System.Collections": "(,4.3.32767]",
"System.Collections.Concurrent": "(,4.3.32767]",
"System.Collections.Immutable": "(,10.0.32767]",
"System.Collections.NonGeneric": "(,4.3.32767]",
"System.Collections.Specialized": "(,4.3.32767]",
"System.ComponentModel": "(,4.3.32767]",
"System.ComponentModel.Annotations": "(,4.3.32767]",
"System.ComponentModel.EventBasedAsync": "(,4.3.32767]",
"System.ComponentModel.Primitives": "(,4.3.32767]",
"System.ComponentModel.TypeConverter": "(,4.3.32767]",
"System.Console": "(,4.3.32767]",
"System.Data.Common": "(,4.3.32767]",
"System.Data.DataSetExtensions": "(,4.4.32767]",
"System.Diagnostics.Contracts": "(,4.3.32767]",
"System.Diagnostics.Debug": "(,4.3.32767]",
"System.Diagnostics.DiagnosticSource": "(,10.0.32767]",
"System.Diagnostics.FileVersionInfo": "(,4.3.32767]",
"System.Diagnostics.Process": "(,4.3.32767]",
"System.Diagnostics.StackTrace": "(,4.3.32767]",
"System.Diagnostics.TextWriterTraceListener": "(,4.3.32767]",
"System.Diagnostics.Tools": "(,4.3.32767]",
"System.Diagnostics.TraceSource": "(,4.3.32767]",
"System.Diagnostics.Tracing": "(,4.3.32767]",
"System.Drawing.Primitives": "(,4.3.32767]",
"System.Dynamic.Runtime": "(,4.3.32767]",
"System.Formats.Asn1": "(,10.0.32767]",
"System.Formats.Tar": "(,10.0.32767]",
"System.Globalization": "(,4.3.32767]",
"System.Globalization.Calendars": "(,4.3.32767]",
"System.Globalization.Extensions": "(,4.3.32767]",
"System.IO": "(,4.3.32767]",
"System.IO.Compression": "(,4.3.32767]",
"System.IO.Compression.ZipFile": "(,4.3.32767]",
"System.IO.FileSystem": "(,4.3.32767]",
"System.IO.FileSystem.AccessControl": "(,4.4.32767]",
"System.IO.FileSystem.DriveInfo": "(,4.3.32767]",
"System.IO.FileSystem.Primitives": "(,4.3.32767]",
"System.IO.FileSystem.Watcher": "(,4.3.32767]",
"System.IO.IsolatedStorage": "(,4.3.32767]",
"System.IO.MemoryMappedFiles": "(,4.3.32767]",
"System.IO.Pipelines": "(,10.0.32767]",
"System.IO.Pipes": "(,4.3.32767]",
"System.IO.Pipes.AccessControl": "(,5.0.32767]",
"System.IO.UnmanagedMemoryStream": "(,4.3.32767]",
"System.Linq": "(,4.3.32767]",
"System.Linq.AsyncEnumerable": "(,10.0.32767]",
"System.Linq.Expressions": "(,4.3.32767]",
"System.Linq.Parallel": "(,4.3.32767]",
"System.Linq.Queryable": "(,4.3.32767]",
"System.Memory": "(,5.0.32767]",
"System.Net.Http": "(,4.3.32767]",
"System.Net.Http.Json": "(,10.0.32767]",
"System.Net.NameResolution": "(,4.3.32767]",
"System.Net.NetworkInformation": "(,4.3.32767]",
"System.Net.Ping": "(,4.3.32767]",
"System.Net.Primitives": "(,4.3.32767]",
"System.Net.Requests": "(,4.3.32767]",
"System.Net.Security": "(,4.3.32767]",
"System.Net.ServerSentEvents": "(,10.0.32767]",
"System.Net.Sockets": "(,4.3.32767]",
"System.Net.WebHeaderCollection": "(,4.3.32767]",
"System.Net.WebSockets": "(,4.3.32767]",
"System.Net.WebSockets.Client": "(,4.3.32767]",
"System.Numerics.Vectors": "(,5.0.32767]",
"System.ObjectModel": "(,4.3.32767]",
"System.Private.DataContractSerialization": "(,4.3.32767]",
"System.Private.Uri": "(,4.3.32767]",
"System.Reflection": "(,4.3.32767]",
"System.Reflection.DispatchProxy": "(,6.0.32767]",
"System.Reflection.Emit": "(,4.7.32767]",
"System.Reflection.Emit.ILGeneration": "(,4.7.32767]",
"System.Reflection.Emit.Lightweight": "(,4.7.32767]",
"System.Reflection.Extensions": "(,4.3.32767]",
"System.Reflection.Metadata": "(,10.0.32767]",
"System.Reflection.Primitives": "(,4.3.32767]",
"System.Reflection.TypeExtensions": "(,4.3.32767]",
"System.Resources.Reader": "(,4.3.32767]",
"System.Resources.ResourceManager": "(,4.3.32767]",
"System.Resources.Writer": "(,4.3.32767]",
"System.Runtime": "(,4.3.32767]",
"System.Runtime.CompilerServices.Unsafe": "(,7.0.32767]",
"System.Runtime.CompilerServices.VisualC": "(,4.3.32767]",
"System.Runtime.Extensions": "(,4.3.32767]",
"System.Runtime.Handles": "(,4.3.32767]",
"System.Runtime.InteropServices": "(,4.3.32767]",
"System.Runtime.InteropServices.RuntimeInformation": "(,4.3.32767]",
"System.Runtime.Loader": "(,4.3.32767]",
"System.Runtime.Numerics": "(,4.3.32767]",
"System.Runtime.Serialization.Formatters": "(,4.3.32767]",
"System.Runtime.Serialization.Json": "(,4.3.32767]",
"System.Runtime.Serialization.Primitives": "(,4.3.32767]",
"System.Runtime.Serialization.Xml": "(,4.3.32767]",
"System.Security.AccessControl": "(,6.0.32767]",
"System.Security.Claims": "(,4.3.32767]",
"System.Security.Cryptography.Algorithms": "(,4.3.32767]",
"System.Security.Cryptography.Cng": "(,5.0.32767]",
"System.Security.Cryptography.Csp": "(,4.3.32767]",
"System.Security.Cryptography.Encoding": "(,4.3.32767]",
"System.Security.Cryptography.OpenSsl": "(,5.0.32767]",
"System.Security.Cryptography.Primitives": "(,4.3.32767]",
"System.Security.Cryptography.X509Certificates": "(,4.3.32767]",
"System.Security.Principal": "(,4.3.32767]",
"System.Security.Principal.Windows": "(,5.0.32767]",
"System.Security.SecureString": "(,4.3.32767]",
"System.Text.Encoding": "(,4.3.32767]",
"System.Text.Encoding.CodePages": "(,10.0.32767]",
"System.Text.Encoding.Extensions": "(,4.3.32767]",
"System.Text.Encodings.Web": "(,10.0.32767]",
"System.Text.Json": "(,10.0.32767]",
"System.Text.RegularExpressions": "(,4.3.32767]",
"System.Threading": "(,4.3.32767]",
"System.Threading.AccessControl": "(,10.0.32767]",
"System.Threading.Channels": "(,10.0.32767]",
"System.Threading.Overlapped": "(,4.3.32767]",
"System.Threading.Tasks": "(,4.3.32767]",
"System.Threading.Tasks.Dataflow": "(,10.0.32767]",
"System.Threading.Tasks.Extensions": "(,5.0.32767]",
"System.Threading.Tasks.Parallel": "(,4.3.32767]",
"System.Threading.Thread": "(,4.3.32767]",
"System.Threading.ThreadPool": "(,4.3.32767]",
"System.Threading.Timer": "(,4.3.32767]",
"System.ValueTuple": "(,4.5.32767]",
"System.Xml.ReaderWriter": "(,4.3.32767]",
"System.Xml.XDocument": "(,4.3.32767]",
"System.Xml.XmlDocument": "(,4.3.32767]",
"System.Xml.XmlSerializer": "(,4.3.32767]",
"System.Xml.XPath": "(,4.3.32767]",
"System.Xml.XPath.XDocument": "(,5.0.32767]"
}
}
}
}
}
@@ -0,0 +1,8 @@
{
"version": 2,
"dgSpecHash": "dVBmfw1EVxI=",
"success": true,
"projectFilePath": "/Users/einand/Code/test/csharp/.dotnet_temp/temp_pi.csproj",
"expectedPackageFiles": [],
"logs": []
}
@@ -0,0 +1,341 @@
{
"format": 1,
"restore": {
"/Users/einand/Code/test/csharp/.dotnet_temp/temp_pi.csproj": {}
},
"projects": {
"/Users/einand/Code/test/csharp/.dotnet_temp/temp_pi.csproj": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "/Users/einand/Code/test/csharp/.dotnet_temp/temp_pi.csproj",
"projectName": "temp_pi",
"projectPath": "/Users/einand/Code/test/csharp/.dotnet_temp/temp_pi.csproj",
"packagesPath": "/Users/einand/.nuget/packages/",
"outputPath": "/Users/einand/Code/test/csharp/.dotnet_temp/obj/",
"projectStyle": "PackageReference",
"configFilePaths": [
"/Users/einand/.nuget/NuGet/NuGet.Config"
],
"originalTargetFrameworks": [
"net10.0"
],
"sources": {
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"net10.0": {
"targetAlias": "net10.0",
"projectReferences": {}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
},
"restoreAuditProperties": {
"enableAudit": "true",
"auditLevel": "low",
"auditMode": "all"
},
"SdkAnalysisLevel": "10.0.200"
},
"frameworks": {
"net10.0": {
"targetAlias": "net10.0",
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48",
"net481"
],
"assetTargetFallback": true,
"warn": true,
"frameworkReferences": {
"Microsoft.NETCore.App": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "/usr/local/share/dotnet/sdk/10.0.203/PortableRuntimeIdentifierGraph.json",
"packagesToPrune": {
"Microsoft.CSharp": "(,4.7.32767]",
"Microsoft.VisualBasic": "(,10.4.32767]",
"Microsoft.Win32.Primitives": "(,4.3.32767]",
"Microsoft.Win32.Registry": "(,5.0.32767]",
"runtime.any.System.Collections": "(,4.3.32767]",
"runtime.any.System.Diagnostics.Tools": "(,4.3.32767]",
"runtime.any.System.Diagnostics.Tracing": "(,4.3.32767]",
"runtime.any.System.Globalization": "(,4.3.32767]",
"runtime.any.System.Globalization.Calendars": "(,4.3.32767]",
"runtime.any.System.IO": "(,4.3.32767]",
"runtime.any.System.Reflection": "(,4.3.32767]",
"runtime.any.System.Reflection.Extensions": "(,4.3.32767]",
"runtime.any.System.Reflection.Primitives": "(,4.3.32767]",
"runtime.any.System.Resources.ResourceManager": "(,4.3.32767]",
"runtime.any.System.Runtime": "(,4.3.32767]",
"runtime.any.System.Runtime.Handles": "(,4.3.32767]",
"runtime.any.System.Runtime.InteropServices": "(,4.3.32767]",
"runtime.any.System.Text.Encoding": "(,4.3.32767]",
"runtime.any.System.Text.Encoding.Extensions": "(,4.3.32767]",
"runtime.any.System.Threading.Tasks": "(,4.3.32767]",
"runtime.any.System.Threading.Timer": "(,4.3.32767]",
"runtime.aot.System.Collections": "(,4.3.32767]",
"runtime.aot.System.Diagnostics.Tools": "(,4.3.32767]",
"runtime.aot.System.Diagnostics.Tracing": "(,4.3.32767]",
"runtime.aot.System.Globalization": "(,4.3.32767]",
"runtime.aot.System.Globalization.Calendars": "(,4.3.32767]",
"runtime.aot.System.IO": "(,4.3.32767]",
"runtime.aot.System.Reflection": "(,4.3.32767]",
"runtime.aot.System.Reflection.Extensions": "(,4.3.32767]",
"runtime.aot.System.Reflection.Primitives": "(,4.3.32767]",
"runtime.aot.System.Resources.ResourceManager": "(,4.3.32767]",
"runtime.aot.System.Runtime": "(,4.3.32767]",
"runtime.aot.System.Runtime.Handles": "(,4.3.32767]",
"runtime.aot.System.Runtime.InteropServices": "(,4.3.32767]",
"runtime.aot.System.Text.Encoding": "(,4.3.32767]",
"runtime.aot.System.Text.Encoding.Extensions": "(,4.3.32767]",
"runtime.aot.System.Threading.Tasks": "(,4.3.32767]",
"runtime.aot.System.Threading.Timer": "(,4.3.32767]",
"runtime.debian.8-x64.runtime.native.System": "(,4.3.32767]",
"runtime.debian.8-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.debian.8-x64.runtime.native.System.Net.Http": "(,4.3.32767]",
"runtime.debian.8-x64.runtime.native.System.Net.Security": "(,4.3.32767]",
"runtime.debian.8-x64.runtime.native.System.Security.Cryptography": "(,4.3.32767]",
"runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl": "(,4.3.32767]",
"runtime.debian.9-x64.runtime.native.System": "(,4.3.32767]",
"runtime.debian.9-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.debian.9-x64.runtime.native.System.Net.Http": "(,4.3.32767]",
"runtime.debian.9-x64.runtime.native.System.Net.Security": "(,4.3.32767]",
"runtime.fedora.23-x64.runtime.native.System": "(,4.3.32767]",
"runtime.fedora.23-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.fedora.23-x64.runtime.native.System.Net.Http": "(,4.3.32767]",
"runtime.fedora.23-x64.runtime.native.System.Net.Security": "(,4.3.32767]",
"runtime.fedora.23-x64.runtime.native.System.Security.Cryptography": "(,4.3.32767]",
"runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl": "(,4.3.32767]",
"runtime.fedora.24-x64.runtime.native.System": "(,4.3.32767]",
"runtime.fedora.24-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.fedora.24-x64.runtime.native.System.Net.Http": "(,4.3.32767]",
"runtime.fedora.24-x64.runtime.native.System.Net.Security": "(,4.3.32767]",
"runtime.fedora.24-x64.runtime.native.System.Security.Cryptography": "(,4.3.32767]",
"runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl": "(,4.3.32767]",
"runtime.fedora.27-x64.runtime.native.System": "(,4.3.32767]",
"runtime.fedora.27-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.fedora.27-x64.runtime.native.System.Net.Http": "(,4.3.32767]",
"runtime.fedora.27-x64.runtime.native.System.Net.Security": "(,4.3.32767]",
"runtime.fedora.28-x64.runtime.native.System": "(,4.3.32767]",
"runtime.fedora.28-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.fedora.28-x64.runtime.native.System.Net.Http": "(,4.3.32767]",
"runtime.fedora.28-x64.runtime.native.System.Net.Security": "(,4.3.32767]",
"runtime.opensuse.13.2-x64.runtime.native.System": "(,4.3.32767]",
"runtime.opensuse.13.2-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.opensuse.13.2-x64.runtime.native.System.Net.Http": "(,4.3.32767]",
"runtime.opensuse.13.2-x64.runtime.native.System.Net.Security": "(,4.3.32767]",
"runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography": "(,4.3.32767]",
"runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl": "(,4.3.32767]",
"runtime.opensuse.42.1-x64.runtime.native.System": "(,4.3.32767]",
"runtime.opensuse.42.1-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.opensuse.42.1-x64.runtime.native.System.Net.Http": "(,4.3.32767]",
"runtime.opensuse.42.1-x64.runtime.native.System.Net.Security": "(,4.3.32767]",
"runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography": "(,4.3.32767]",
"runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl": "(,4.3.32767]",
"runtime.opensuse.42.3-x64.runtime.native.System": "(,4.3.32767]",
"runtime.opensuse.42.3-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.opensuse.42.3-x64.runtime.native.System.Net.Http": "(,4.3.32767]",
"runtime.opensuse.42.3-x64.runtime.native.System.Net.Security": "(,4.3.32767]",
"runtime.osx.10.10-x64.runtime.native.System": "(,4.3.32767]",
"runtime.osx.10.10-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.osx.10.10-x64.runtime.native.System.Net.Http": "(,4.3.32767]",
"runtime.osx.10.10-x64.runtime.native.System.Net.Security": "(,4.3.32767]",
"runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography": "(,4.3.32767]",
"runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple": "(,4.3.32767]",
"runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl": "(,4.3.32767]",
"runtime.rhel.7-x64.runtime.native.System": "(,4.3.32767]",
"runtime.rhel.7-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.rhel.7-x64.runtime.native.System.Net.Http": "(,4.3.32767]",
"runtime.rhel.7-x64.runtime.native.System.Net.Security": "(,4.3.32767]",
"runtime.rhel.7-x64.runtime.native.System.Security.Cryptography": "(,4.3.32767]",
"runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl": "(,4.3.32767]",
"runtime.ubuntu.14.04-x64.runtime.native.System": "(,4.3.32767]",
"runtime.ubuntu.14.04-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.ubuntu.14.04-x64.runtime.native.System.Net.Http": "(,4.3.32767]",
"runtime.ubuntu.14.04-x64.runtime.native.System.Net.Security": "(,4.3.32767]",
"runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography": "(,4.3.32767]",
"runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": "(,4.3.32767]",
"runtime.ubuntu.16.04-x64.runtime.native.System": "(,4.3.32767]",
"runtime.ubuntu.16.04-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.ubuntu.16.04-x64.runtime.native.System.Net.Http": "(,4.3.32767]",
"runtime.ubuntu.16.04-x64.runtime.native.System.Net.Security": "(,4.3.32767]",
"runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography": "(,4.3.32767]",
"runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": "(,4.3.32767]",
"runtime.ubuntu.16.10-x64.runtime.native.System": "(,4.3.32767]",
"runtime.ubuntu.16.10-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.ubuntu.16.10-x64.runtime.native.System.Net.Http": "(,4.3.32767]",
"runtime.ubuntu.16.10-x64.runtime.native.System.Net.Security": "(,4.3.32767]",
"runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography": "(,4.3.32767]",
"runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl": "(,4.3.32767]",
"runtime.ubuntu.18.04-x64.runtime.native.System": "(,4.3.32767]",
"runtime.ubuntu.18.04-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.ubuntu.18.04-x64.runtime.native.System.Net.Http": "(,4.3.32767]",
"runtime.ubuntu.18.04-x64.runtime.native.System.Net.Security": "(,4.3.32767]",
"runtime.unix.Microsoft.Win32.Primitives": "(,4.3.32767]",
"runtime.unix.System.Console": "(,4.3.32767]",
"runtime.unix.System.Diagnostics.Debug": "(,4.3.32767]",
"runtime.unix.System.IO.FileSystem": "(,4.3.32767]",
"runtime.unix.System.Net.Primitives": "(,4.3.32767]",
"runtime.unix.System.Net.Sockets": "(,4.3.32767]",
"runtime.unix.System.Private.Uri": "(,4.3.32767]",
"runtime.unix.System.Runtime.Extensions": "(,4.3.32767]",
"runtime.win.Microsoft.Win32.Primitives": "(,4.3.32767]",
"runtime.win.System.Console": "(,4.3.32767]",
"runtime.win.System.Diagnostics.Debug": "(,4.3.32767]",
"runtime.win.System.IO.FileSystem": "(,4.3.32767]",
"runtime.win.System.Net.Primitives": "(,4.3.32767]",
"runtime.win.System.Net.Sockets": "(,4.3.32767]",
"runtime.win.System.Runtime.Extensions": "(,4.3.32767]",
"runtime.win10-arm-aot.runtime.native.System.IO.Compression": "(,4.0.32767]",
"runtime.win10-arm64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.win10-x64-aot.runtime.native.System.IO.Compression": "(,4.0.32767]",
"runtime.win10-x86-aot.runtime.native.System.IO.Compression": "(,4.0.32767]",
"runtime.win7-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.win7-x86.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.win7.System.Private.Uri": "(,4.3.32767]",
"runtime.win8-arm.runtime.native.System.IO.Compression": "(,4.3.32767]",
"System.AppContext": "(,4.3.32767]",
"System.Buffers": "(,5.0.32767]",
"System.Collections": "(,4.3.32767]",
"System.Collections.Concurrent": "(,4.3.32767]",
"System.Collections.Immutable": "(,10.0.32767]",
"System.Collections.NonGeneric": "(,4.3.32767]",
"System.Collections.Specialized": "(,4.3.32767]",
"System.ComponentModel": "(,4.3.32767]",
"System.ComponentModel.Annotations": "(,4.3.32767]",
"System.ComponentModel.EventBasedAsync": "(,4.3.32767]",
"System.ComponentModel.Primitives": "(,4.3.32767]",
"System.ComponentModel.TypeConverter": "(,4.3.32767]",
"System.Console": "(,4.3.32767]",
"System.Data.Common": "(,4.3.32767]",
"System.Data.DataSetExtensions": "(,4.4.32767]",
"System.Diagnostics.Contracts": "(,4.3.32767]",
"System.Diagnostics.Debug": "(,4.3.32767]",
"System.Diagnostics.DiagnosticSource": "(,10.0.32767]",
"System.Diagnostics.FileVersionInfo": "(,4.3.32767]",
"System.Diagnostics.Process": "(,4.3.32767]",
"System.Diagnostics.StackTrace": "(,4.3.32767]",
"System.Diagnostics.TextWriterTraceListener": "(,4.3.32767]",
"System.Diagnostics.Tools": "(,4.3.32767]",
"System.Diagnostics.TraceSource": "(,4.3.32767]",
"System.Diagnostics.Tracing": "(,4.3.32767]",
"System.Drawing.Primitives": "(,4.3.32767]",
"System.Dynamic.Runtime": "(,4.3.32767]",
"System.Formats.Asn1": "(,10.0.32767]",
"System.Formats.Tar": "(,10.0.32767]",
"System.Globalization": "(,4.3.32767]",
"System.Globalization.Calendars": "(,4.3.32767]",
"System.Globalization.Extensions": "(,4.3.32767]",
"System.IO": "(,4.3.32767]",
"System.IO.Compression": "(,4.3.32767]",
"System.IO.Compression.ZipFile": "(,4.3.32767]",
"System.IO.FileSystem": "(,4.3.32767]",
"System.IO.FileSystem.AccessControl": "(,4.4.32767]",
"System.IO.FileSystem.DriveInfo": "(,4.3.32767]",
"System.IO.FileSystem.Primitives": "(,4.3.32767]",
"System.IO.FileSystem.Watcher": "(,4.3.32767]",
"System.IO.IsolatedStorage": "(,4.3.32767]",
"System.IO.MemoryMappedFiles": "(,4.3.32767]",
"System.IO.Pipelines": "(,10.0.32767]",
"System.IO.Pipes": "(,4.3.32767]",
"System.IO.Pipes.AccessControl": "(,5.0.32767]",
"System.IO.UnmanagedMemoryStream": "(,4.3.32767]",
"System.Linq": "(,4.3.32767]",
"System.Linq.AsyncEnumerable": "(,10.0.32767]",
"System.Linq.Expressions": "(,4.3.32767]",
"System.Linq.Parallel": "(,4.3.32767]",
"System.Linq.Queryable": "(,4.3.32767]",
"System.Memory": "(,5.0.32767]",
"System.Net.Http": "(,4.3.32767]",
"System.Net.Http.Json": "(,10.0.32767]",
"System.Net.NameResolution": "(,4.3.32767]",
"System.Net.NetworkInformation": "(,4.3.32767]",
"System.Net.Ping": "(,4.3.32767]",
"System.Net.Primitives": "(,4.3.32767]",
"System.Net.Requests": "(,4.3.32767]",
"System.Net.Security": "(,4.3.32767]",
"System.Net.ServerSentEvents": "(,10.0.32767]",
"System.Net.Sockets": "(,4.3.32767]",
"System.Net.WebHeaderCollection": "(,4.3.32767]",
"System.Net.WebSockets": "(,4.3.32767]",
"System.Net.WebSockets.Client": "(,4.3.32767]",
"System.Numerics.Vectors": "(,5.0.32767]",
"System.ObjectModel": "(,4.3.32767]",
"System.Private.DataContractSerialization": "(,4.3.32767]",
"System.Private.Uri": "(,4.3.32767]",
"System.Reflection": "(,4.3.32767]",
"System.Reflection.DispatchProxy": "(,6.0.32767]",
"System.Reflection.Emit": "(,4.7.32767]",
"System.Reflection.Emit.ILGeneration": "(,4.7.32767]",
"System.Reflection.Emit.Lightweight": "(,4.7.32767]",
"System.Reflection.Extensions": "(,4.3.32767]",
"System.Reflection.Metadata": "(,10.0.32767]",
"System.Reflection.Primitives": "(,4.3.32767]",
"System.Reflection.TypeExtensions": "(,4.3.32767]",
"System.Resources.Reader": "(,4.3.32767]",
"System.Resources.ResourceManager": "(,4.3.32767]",
"System.Resources.Writer": "(,4.3.32767]",
"System.Runtime": "(,4.3.32767]",
"System.Runtime.CompilerServices.Unsafe": "(,7.0.32767]",
"System.Runtime.CompilerServices.VisualC": "(,4.3.32767]",
"System.Runtime.Extensions": "(,4.3.32767]",
"System.Runtime.Handles": "(,4.3.32767]",
"System.Runtime.InteropServices": "(,4.3.32767]",
"System.Runtime.InteropServices.RuntimeInformation": "(,4.3.32767]",
"System.Runtime.Loader": "(,4.3.32767]",
"System.Runtime.Numerics": "(,4.3.32767]",
"System.Runtime.Serialization.Formatters": "(,4.3.32767]",
"System.Runtime.Serialization.Json": "(,4.3.32767]",
"System.Runtime.Serialization.Primitives": "(,4.3.32767]",
"System.Runtime.Serialization.Xml": "(,4.3.32767]",
"System.Security.AccessControl": "(,6.0.32767]",
"System.Security.Claims": "(,4.3.32767]",
"System.Security.Cryptography.Algorithms": "(,4.3.32767]",
"System.Security.Cryptography.Cng": "(,5.0.32767]",
"System.Security.Cryptography.Csp": "(,4.3.32767]",
"System.Security.Cryptography.Encoding": "(,4.3.32767]",
"System.Security.Cryptography.OpenSsl": "(,5.0.32767]",
"System.Security.Cryptography.Primitives": "(,4.3.32767]",
"System.Security.Cryptography.X509Certificates": "(,4.3.32767]",
"System.Security.Principal": "(,4.3.32767]",
"System.Security.Principal.Windows": "(,5.0.32767]",
"System.Security.SecureString": "(,4.3.32767]",
"System.Text.Encoding": "(,4.3.32767]",
"System.Text.Encoding.CodePages": "(,10.0.32767]",
"System.Text.Encoding.Extensions": "(,4.3.32767]",
"System.Text.Encodings.Web": "(,10.0.32767]",
"System.Text.Json": "(,10.0.32767]",
"System.Text.RegularExpressions": "(,4.3.32767]",
"System.Threading": "(,4.3.32767]",
"System.Threading.AccessControl": "(,10.0.32767]",
"System.Threading.Channels": "(,10.0.32767]",
"System.Threading.Overlapped": "(,4.3.32767]",
"System.Threading.Tasks": "(,4.3.32767]",
"System.Threading.Tasks.Dataflow": "(,10.0.32767]",
"System.Threading.Tasks.Extensions": "(,5.0.32767]",
"System.Threading.Tasks.Parallel": "(,4.3.32767]",
"System.Threading.Thread": "(,4.3.32767]",
"System.Threading.ThreadPool": "(,4.3.32767]",
"System.Threading.Timer": "(,4.3.32767]",
"System.ValueTuple": "(,4.5.32767]",
"System.Xml.ReaderWriter": "(,4.3.32767]",
"System.Xml.XDocument": "(,4.3.32767]",
"System.Xml.XmlDocument": "(,4.3.32767]",
"System.Xml.XmlSerializer": "(,4.3.32767]",
"System.Xml.XPath": "(,4.3.32767]",
"System.Xml.XPath.XDocument": "(,5.0.32767]"
}
}
}
}
}
}
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">/Users/einand/.nuget/packages/</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">/Users/einand/.nuget/packages/</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">7.0.0</NuGetToolVersion>
</PropertyGroup>
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<SourceRoot Include="/Users/einand/.nuget/packages/" />
</ItemGroup>
</Project>
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />
+10
View File
@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>
+38
View File
@@ -0,0 +1,38 @@
#!/bin/bash
# C# Build Script
SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
cd "$SCRIPT_DIR"
echo "=== C# Build ==="
echo ""
# Kompilera C#-programmet
cd src
dotnet build -c Release
if [ $? -eq 0 ]; then
# Hitta rätt .NET-version dynamiskt
DOTNET_VERSION=$(ls -1 bin/Release/ | grep -E '^net[0-9]+\.[0-9]+$' | head -1)
echo "✓ Kompilering lyckades!"
echo "Binär: src/bin/Release/$DOTNET_VERSION/print_hej"
echo ""
echo "För att köra:"
echo " dotnet src/bin/Release/$DOTNET_VERSION/print_hej.dll [decimaler]"
# Skapa wrapper script
mkdir -p ../bin
cat > ../bin/print_hej << EOF
#!/bin/bash
SCRIPT_DIR="\$(cd "\$(dirname "\$0")/.." && pwd)"
cd "\$SCRIPT_DIR"
dotnet src/bin/Release/$DOTNET_VERSION/print_hej.dll "\$@"
EOF
chmod +x ../bin/print_hej
echo "Wrapper script skapad: bin/print_hej"
else
echo "✗ Kompilering misslyckades!"
exit 1
fi
+14
View File
@@ -0,0 +1,14 @@
#!/bin/bash
# C# Unit Tests
SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
cd "$SCRIPT_DIR"
echo "=== C# Pi-beräkning Unit Tester ==="
echo ""
cd src
dotnet test
exit $?
+78
View File
@@ -0,0 +1,78 @@
using System;
using System.Diagnostics;
using Xunit;
namespace PiTests
{
public class PiTests
{
private const string ScriptPath = "/Users/einand/Code/test/csharp/print_hej";
private string RunScript(string args = null)
{
var startInfo = new ProcessStartInfo
{
FileName = ScriptPath,
Arguments = args ?? "",
RedirectStandardOutput = true,
UseShellExecute = false
};
using (var process = Process.Start(startInfo))
{
var result = process.StandardOutput.ReadToEnd().Trim();
process.WaitForExit();
return result;
}
}
[Fact]
public void Test10Decimals()
{
var result = RunScript("10");
var expected = "3.1415926535";
Assert.Equal(expected, result);
}
[Fact]
public void Test5Decimals()
{
var result = RunScript("5");
var expected = "3.14159";
Assert.Equal(expected, result);
}
[Fact]
public void Test1Decimal()
{
var result = RunScript("1");
var expected = "3.1";
Assert.Equal(expected, result);
}
[Fact]
public void Test100Decimals()
{
var result = RunScript("100");
var expected = "3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679";
Assert.Equal(expected, result);
}
[Fact]
public void TestDefault100Decimals()
{
var result = RunScript();
var expected = "3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679";
Assert.Equal(expected, result);
}
[Fact]
public void Test10000Decimals()
{
var result = RunScript("10000");
// Check length: "3." + 10000 digits = 10002 characters
Assert.Equal(10002, result.Length);
Assert.StartsWith("3.14159", result);
}
}
}
@@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v10.0", FrameworkDisplayName = ".NET 10.0")]
Binary file not shown.
@@ -0,0 +1,22 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("print_hej")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("print_hej")]
[assembly: System.Reflection.AssemblyTitleAttribute("print_hej")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Generated by the MSBuild WriteCodeFragment class.
@@ -0,0 +1 @@
9324562fecfe65b81ece195077e8b3a7cf0ee90cf8e00b3fecfede514b6ce9e8
@@ -0,0 +1,17 @@
is_global = true
build_property.TargetFramework = net10.0
build_property.TargetFrameworkIdentifier = .NETCoreApp
build_property.TargetFrameworkVersion = v10.0
build_property.TargetPlatformMinVersion =
build_property.UsingMicrosoftNETSdkWeb =
build_property.ProjectTypeGuids =
build_property.InvariantGlobalization =
build_property.PlatformNeutralAssembly =
build_property.EnforceExtendedAnalyzerRules =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = print_hej
build_property.ProjectDir = /Users/einand/Code/test/csharp/src/
build_property.EnableComHosting =
build_property.EnableGeneratedComInterfaceComImportInterop =
build_property.EffectiveAnalysisLevelStyle = 10.0
build_property.EnableCodeStyleSeverity =
@@ -0,0 +1,8 @@
// <auto-generated/>
global using System;
global using System.Collections.Generic;
global using System.IO;
global using System.Linq;
global using System.Net.Http;
global using System.Threading;
global using System.Threading.Tasks;
@@ -0,0 +1 @@
722ece028348cdcaacef3b0cac3b83e003f567cf56fab18454f8fa25c624cd34
@@ -0,0 +1,14 @@
/Users/einand/Code/test/csharp/src/bin/Release/net10.0/print_hej
/Users/einand/Code/test/csharp/src/bin/Release/net10.0/print_hej.deps.json
/Users/einand/Code/test/csharp/src/bin/Release/net10.0/print_hej.runtimeconfig.json
/Users/einand/Code/test/csharp/src/bin/Release/net10.0/print_hej.dll
/Users/einand/Code/test/csharp/src/bin/Release/net10.0/print_hej.pdb
/Users/einand/Code/test/csharp/src/obj/Release/net10.0/print_hej.GeneratedMSBuildEditorConfig.editorconfig
/Users/einand/Code/test/csharp/src/obj/Release/net10.0/print_hej.AssemblyInfoInputs.cache
/Users/einand/Code/test/csharp/src/obj/Release/net10.0/print_hej.AssemblyInfo.cs
/Users/einand/Code/test/csharp/src/obj/Release/net10.0/print_hej.csproj.CoreCompileInputs.cache
/Users/einand/Code/test/csharp/src/obj/Release/net10.0/print_hej.dll
/Users/einand/Code/test/csharp/src/obj/Release/net10.0/refint/print_hej.dll
/Users/einand/Code/test/csharp/src/obj/Release/net10.0/print_hej.pdb
/Users/einand/Code/test/csharp/src/obj/Release/net10.0/print_hej.genruntimeconfig.cache
/Users/einand/Code/test/csharp/src/obj/Release/net10.0/ref/print_hej.dll
Binary file not shown.
@@ -0,0 +1 @@
1a2a5bb55fd68dc9c521cac37bb8cd66c27940836461e83744d9937fa2fdf49f
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")]
Binary file not shown.
@@ -0,0 +1,22 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("print_hej")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("print_hej")]
[assembly: System.Reflection.AssemblyTitleAttribute("print_hej")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Generated by the MSBuild WriteCodeFragment class.
@@ -0,0 +1 @@
9324562fecfe65b81ece195077e8b3a7cf0ee90cf8e00b3fecfede514b6ce9e8
@@ -0,0 +1,17 @@
is_global = true
build_property.TargetFramework = net8.0
build_property.TargetFrameworkIdentifier = .NETCoreApp
build_property.TargetFrameworkVersion = v8.0
build_property.TargetPlatformMinVersion =
build_property.UsingMicrosoftNETSdkWeb =
build_property.ProjectTypeGuids =
build_property.InvariantGlobalization =
build_property.PlatformNeutralAssembly =
build_property.EnforceExtendedAnalyzerRules =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = print_hej
build_property.ProjectDir = /Users/einand/Code/test/csharp/src/
build_property.EnableComHosting =
build_property.EnableGeneratedComInterfaceComImportInterop =
build_property.EffectiveAnalysisLevelStyle = 8.0
build_property.EnableCodeStyleSeverity =
@@ -0,0 +1,8 @@
// <auto-generated/>
global using System;
global using System.Collections.Generic;
global using System.IO;
global using System.Linq;
global using System.Net.Http;
global using System.Threading;
global using System.Threading.Tasks;
Binary file not shown.
@@ -0,0 +1 @@
a49e4a6d2ede054e259f4eef033e52c3042e8420e08014fa82e52040200d1535
@@ -0,0 +1,14 @@
/Users/einand/Code/test/csharp/src/obj/Release/net8.0/print_hej.GeneratedMSBuildEditorConfig.editorconfig
/Users/einand/Code/test/csharp/src/obj/Release/net8.0/print_hej.AssemblyInfoInputs.cache
/Users/einand/Code/test/csharp/src/obj/Release/net8.0/print_hej.AssemblyInfo.cs
/Users/einand/Code/test/csharp/src/obj/Release/net8.0/print_hej.csproj.CoreCompileInputs.cache
/Users/einand/Code/test/csharp/src/bin/Release/net8.0/print_hej
/Users/einand/Code/test/csharp/src/bin/Release/net8.0/print_hej.deps.json
/Users/einand/Code/test/csharp/src/bin/Release/net8.0/print_hej.runtimeconfig.json
/Users/einand/Code/test/csharp/src/bin/Release/net8.0/print_hej.dll
/Users/einand/Code/test/csharp/src/bin/Release/net8.0/print_hej.pdb
/Users/einand/Code/test/csharp/src/obj/Release/net8.0/print_hej.dll
/Users/einand/Code/test/csharp/src/obj/Release/net8.0/refint/print_hej.dll
/Users/einand/Code/test/csharp/src/obj/Release/net8.0/print_hej.pdb
/Users/einand/Code/test/csharp/src/obj/Release/net8.0/print_hej.genruntimeconfig.cache
/Users/einand/Code/test/csharp/src/obj/Release/net8.0/ref/print_hej.dll
Binary file not shown.
@@ -0,0 +1 @@
17977dba7d1c495f6863b0c77a609caad66c01dc9fef6eaa098cae6902184a5a
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,341 @@
{
"format": 1,
"restore": {
"/Users/einand/Code/test/csharp/src/print_hej.csproj": {}
},
"projects": {
"/Users/einand/Code/test/csharp/src/print_hej.csproj": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "/Users/einand/Code/test/csharp/src/print_hej.csproj",
"projectName": "print_hej",
"projectPath": "/Users/einand/Code/test/csharp/src/print_hej.csproj",
"packagesPath": "/Users/einand/.nuget/packages/",
"outputPath": "/Users/einand/Code/test/csharp/src/obj/",
"projectStyle": "PackageReference",
"configFilePaths": [
"/Users/einand/.nuget/NuGet/NuGet.Config"
],
"originalTargetFrameworks": [
"net10.0"
],
"sources": {
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"net10.0": {
"targetAlias": "net10.0",
"projectReferences": {}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
},
"restoreAuditProperties": {
"enableAudit": "true",
"auditLevel": "low",
"auditMode": "all"
},
"SdkAnalysisLevel": "10.0.200"
},
"frameworks": {
"net10.0": {
"targetAlias": "net10.0",
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48",
"net481"
],
"assetTargetFallback": true,
"warn": true,
"frameworkReferences": {
"Microsoft.NETCore.App": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "/usr/local/share/dotnet/sdk/10.0.203/PortableRuntimeIdentifierGraph.json",
"packagesToPrune": {
"Microsoft.CSharp": "(,4.7.32767]",
"Microsoft.VisualBasic": "(,10.4.32767]",
"Microsoft.Win32.Primitives": "(,4.3.32767]",
"Microsoft.Win32.Registry": "(,5.0.32767]",
"runtime.any.System.Collections": "(,4.3.32767]",
"runtime.any.System.Diagnostics.Tools": "(,4.3.32767]",
"runtime.any.System.Diagnostics.Tracing": "(,4.3.32767]",
"runtime.any.System.Globalization": "(,4.3.32767]",
"runtime.any.System.Globalization.Calendars": "(,4.3.32767]",
"runtime.any.System.IO": "(,4.3.32767]",
"runtime.any.System.Reflection": "(,4.3.32767]",
"runtime.any.System.Reflection.Extensions": "(,4.3.32767]",
"runtime.any.System.Reflection.Primitives": "(,4.3.32767]",
"runtime.any.System.Resources.ResourceManager": "(,4.3.32767]",
"runtime.any.System.Runtime": "(,4.3.32767]",
"runtime.any.System.Runtime.Handles": "(,4.3.32767]",
"runtime.any.System.Runtime.InteropServices": "(,4.3.32767]",
"runtime.any.System.Text.Encoding": "(,4.3.32767]",
"runtime.any.System.Text.Encoding.Extensions": "(,4.3.32767]",
"runtime.any.System.Threading.Tasks": "(,4.3.32767]",
"runtime.any.System.Threading.Timer": "(,4.3.32767]",
"runtime.aot.System.Collections": "(,4.3.32767]",
"runtime.aot.System.Diagnostics.Tools": "(,4.3.32767]",
"runtime.aot.System.Diagnostics.Tracing": "(,4.3.32767]",
"runtime.aot.System.Globalization": "(,4.3.32767]",
"runtime.aot.System.Globalization.Calendars": "(,4.3.32767]",
"runtime.aot.System.IO": "(,4.3.32767]",
"runtime.aot.System.Reflection": "(,4.3.32767]",
"runtime.aot.System.Reflection.Extensions": "(,4.3.32767]",
"runtime.aot.System.Reflection.Primitives": "(,4.3.32767]",
"runtime.aot.System.Resources.ResourceManager": "(,4.3.32767]",
"runtime.aot.System.Runtime": "(,4.3.32767]",
"runtime.aot.System.Runtime.Handles": "(,4.3.32767]",
"runtime.aot.System.Runtime.InteropServices": "(,4.3.32767]",
"runtime.aot.System.Text.Encoding": "(,4.3.32767]",
"runtime.aot.System.Text.Encoding.Extensions": "(,4.3.32767]",
"runtime.aot.System.Threading.Tasks": "(,4.3.32767]",
"runtime.aot.System.Threading.Timer": "(,4.3.32767]",
"runtime.debian.8-x64.runtime.native.System": "(,4.3.32767]",
"runtime.debian.8-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.debian.8-x64.runtime.native.System.Net.Http": "(,4.3.32767]",
"runtime.debian.8-x64.runtime.native.System.Net.Security": "(,4.3.32767]",
"runtime.debian.8-x64.runtime.native.System.Security.Cryptography": "(,4.3.32767]",
"runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl": "(,4.3.32767]",
"runtime.debian.9-x64.runtime.native.System": "(,4.3.32767]",
"runtime.debian.9-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.debian.9-x64.runtime.native.System.Net.Http": "(,4.3.32767]",
"runtime.debian.9-x64.runtime.native.System.Net.Security": "(,4.3.32767]",
"runtime.fedora.23-x64.runtime.native.System": "(,4.3.32767]",
"runtime.fedora.23-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.fedora.23-x64.runtime.native.System.Net.Http": "(,4.3.32767]",
"runtime.fedora.23-x64.runtime.native.System.Net.Security": "(,4.3.32767]",
"runtime.fedora.23-x64.runtime.native.System.Security.Cryptography": "(,4.3.32767]",
"runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl": "(,4.3.32767]",
"runtime.fedora.24-x64.runtime.native.System": "(,4.3.32767]",
"runtime.fedora.24-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.fedora.24-x64.runtime.native.System.Net.Http": "(,4.3.32767]",
"runtime.fedora.24-x64.runtime.native.System.Net.Security": "(,4.3.32767]",
"runtime.fedora.24-x64.runtime.native.System.Security.Cryptography": "(,4.3.32767]",
"runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl": "(,4.3.32767]",
"runtime.fedora.27-x64.runtime.native.System": "(,4.3.32767]",
"runtime.fedora.27-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.fedora.27-x64.runtime.native.System.Net.Http": "(,4.3.32767]",
"runtime.fedora.27-x64.runtime.native.System.Net.Security": "(,4.3.32767]",
"runtime.fedora.28-x64.runtime.native.System": "(,4.3.32767]",
"runtime.fedora.28-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.fedora.28-x64.runtime.native.System.Net.Http": "(,4.3.32767]",
"runtime.fedora.28-x64.runtime.native.System.Net.Security": "(,4.3.32767]",
"runtime.opensuse.13.2-x64.runtime.native.System": "(,4.3.32767]",
"runtime.opensuse.13.2-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.opensuse.13.2-x64.runtime.native.System.Net.Http": "(,4.3.32767]",
"runtime.opensuse.13.2-x64.runtime.native.System.Net.Security": "(,4.3.32767]",
"runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography": "(,4.3.32767]",
"runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl": "(,4.3.32767]",
"runtime.opensuse.42.1-x64.runtime.native.System": "(,4.3.32767]",
"runtime.opensuse.42.1-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.opensuse.42.1-x64.runtime.native.System.Net.Http": "(,4.3.32767]",
"runtime.opensuse.42.1-x64.runtime.native.System.Net.Security": "(,4.3.32767]",
"runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography": "(,4.3.32767]",
"runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl": "(,4.3.32767]",
"runtime.opensuse.42.3-x64.runtime.native.System": "(,4.3.32767]",
"runtime.opensuse.42.3-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.opensuse.42.3-x64.runtime.native.System.Net.Http": "(,4.3.32767]",
"runtime.opensuse.42.3-x64.runtime.native.System.Net.Security": "(,4.3.32767]",
"runtime.osx.10.10-x64.runtime.native.System": "(,4.3.32767]",
"runtime.osx.10.10-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.osx.10.10-x64.runtime.native.System.Net.Http": "(,4.3.32767]",
"runtime.osx.10.10-x64.runtime.native.System.Net.Security": "(,4.3.32767]",
"runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography": "(,4.3.32767]",
"runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple": "(,4.3.32767]",
"runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl": "(,4.3.32767]",
"runtime.rhel.7-x64.runtime.native.System": "(,4.3.32767]",
"runtime.rhel.7-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.rhel.7-x64.runtime.native.System.Net.Http": "(,4.3.32767]",
"runtime.rhel.7-x64.runtime.native.System.Net.Security": "(,4.3.32767]",
"runtime.rhel.7-x64.runtime.native.System.Security.Cryptography": "(,4.3.32767]",
"runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl": "(,4.3.32767]",
"runtime.ubuntu.14.04-x64.runtime.native.System": "(,4.3.32767]",
"runtime.ubuntu.14.04-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.ubuntu.14.04-x64.runtime.native.System.Net.Http": "(,4.3.32767]",
"runtime.ubuntu.14.04-x64.runtime.native.System.Net.Security": "(,4.3.32767]",
"runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography": "(,4.3.32767]",
"runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": "(,4.3.32767]",
"runtime.ubuntu.16.04-x64.runtime.native.System": "(,4.3.32767]",
"runtime.ubuntu.16.04-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.ubuntu.16.04-x64.runtime.native.System.Net.Http": "(,4.3.32767]",
"runtime.ubuntu.16.04-x64.runtime.native.System.Net.Security": "(,4.3.32767]",
"runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography": "(,4.3.32767]",
"runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": "(,4.3.32767]",
"runtime.ubuntu.16.10-x64.runtime.native.System": "(,4.3.32767]",
"runtime.ubuntu.16.10-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.ubuntu.16.10-x64.runtime.native.System.Net.Http": "(,4.3.32767]",
"runtime.ubuntu.16.10-x64.runtime.native.System.Net.Security": "(,4.3.32767]",
"runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography": "(,4.3.32767]",
"runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl": "(,4.3.32767]",
"runtime.ubuntu.18.04-x64.runtime.native.System": "(,4.3.32767]",
"runtime.ubuntu.18.04-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.ubuntu.18.04-x64.runtime.native.System.Net.Http": "(,4.3.32767]",
"runtime.ubuntu.18.04-x64.runtime.native.System.Net.Security": "(,4.3.32767]",
"runtime.unix.Microsoft.Win32.Primitives": "(,4.3.32767]",
"runtime.unix.System.Console": "(,4.3.32767]",
"runtime.unix.System.Diagnostics.Debug": "(,4.3.32767]",
"runtime.unix.System.IO.FileSystem": "(,4.3.32767]",
"runtime.unix.System.Net.Primitives": "(,4.3.32767]",
"runtime.unix.System.Net.Sockets": "(,4.3.32767]",
"runtime.unix.System.Private.Uri": "(,4.3.32767]",
"runtime.unix.System.Runtime.Extensions": "(,4.3.32767]",
"runtime.win.Microsoft.Win32.Primitives": "(,4.3.32767]",
"runtime.win.System.Console": "(,4.3.32767]",
"runtime.win.System.Diagnostics.Debug": "(,4.3.32767]",
"runtime.win.System.IO.FileSystem": "(,4.3.32767]",
"runtime.win.System.Net.Primitives": "(,4.3.32767]",
"runtime.win.System.Net.Sockets": "(,4.3.32767]",
"runtime.win.System.Runtime.Extensions": "(,4.3.32767]",
"runtime.win10-arm-aot.runtime.native.System.IO.Compression": "(,4.0.32767]",
"runtime.win10-arm64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.win10-x64-aot.runtime.native.System.IO.Compression": "(,4.0.32767]",
"runtime.win10-x86-aot.runtime.native.System.IO.Compression": "(,4.0.32767]",
"runtime.win7-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.win7-x86.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.win7.System.Private.Uri": "(,4.3.32767]",
"runtime.win8-arm.runtime.native.System.IO.Compression": "(,4.3.32767]",
"System.AppContext": "(,4.3.32767]",
"System.Buffers": "(,5.0.32767]",
"System.Collections": "(,4.3.32767]",
"System.Collections.Concurrent": "(,4.3.32767]",
"System.Collections.Immutable": "(,10.0.32767]",
"System.Collections.NonGeneric": "(,4.3.32767]",
"System.Collections.Specialized": "(,4.3.32767]",
"System.ComponentModel": "(,4.3.32767]",
"System.ComponentModel.Annotations": "(,4.3.32767]",
"System.ComponentModel.EventBasedAsync": "(,4.3.32767]",
"System.ComponentModel.Primitives": "(,4.3.32767]",
"System.ComponentModel.TypeConverter": "(,4.3.32767]",
"System.Console": "(,4.3.32767]",
"System.Data.Common": "(,4.3.32767]",
"System.Data.DataSetExtensions": "(,4.4.32767]",
"System.Diagnostics.Contracts": "(,4.3.32767]",
"System.Diagnostics.Debug": "(,4.3.32767]",
"System.Diagnostics.DiagnosticSource": "(,10.0.32767]",
"System.Diagnostics.FileVersionInfo": "(,4.3.32767]",
"System.Diagnostics.Process": "(,4.3.32767]",
"System.Diagnostics.StackTrace": "(,4.3.32767]",
"System.Diagnostics.TextWriterTraceListener": "(,4.3.32767]",
"System.Diagnostics.Tools": "(,4.3.32767]",
"System.Diagnostics.TraceSource": "(,4.3.32767]",
"System.Diagnostics.Tracing": "(,4.3.32767]",
"System.Drawing.Primitives": "(,4.3.32767]",
"System.Dynamic.Runtime": "(,4.3.32767]",
"System.Formats.Asn1": "(,10.0.32767]",
"System.Formats.Tar": "(,10.0.32767]",
"System.Globalization": "(,4.3.32767]",
"System.Globalization.Calendars": "(,4.3.32767]",
"System.Globalization.Extensions": "(,4.3.32767]",
"System.IO": "(,4.3.32767]",
"System.IO.Compression": "(,4.3.32767]",
"System.IO.Compression.ZipFile": "(,4.3.32767]",
"System.IO.FileSystem": "(,4.3.32767]",
"System.IO.FileSystem.AccessControl": "(,4.4.32767]",
"System.IO.FileSystem.DriveInfo": "(,4.3.32767]",
"System.IO.FileSystem.Primitives": "(,4.3.32767]",
"System.IO.FileSystem.Watcher": "(,4.3.32767]",
"System.IO.IsolatedStorage": "(,4.3.32767]",
"System.IO.MemoryMappedFiles": "(,4.3.32767]",
"System.IO.Pipelines": "(,10.0.32767]",
"System.IO.Pipes": "(,4.3.32767]",
"System.IO.Pipes.AccessControl": "(,5.0.32767]",
"System.IO.UnmanagedMemoryStream": "(,4.3.32767]",
"System.Linq": "(,4.3.32767]",
"System.Linq.AsyncEnumerable": "(,10.0.32767]",
"System.Linq.Expressions": "(,4.3.32767]",
"System.Linq.Parallel": "(,4.3.32767]",
"System.Linq.Queryable": "(,4.3.32767]",
"System.Memory": "(,5.0.32767]",
"System.Net.Http": "(,4.3.32767]",
"System.Net.Http.Json": "(,10.0.32767]",
"System.Net.NameResolution": "(,4.3.32767]",
"System.Net.NetworkInformation": "(,4.3.32767]",
"System.Net.Ping": "(,4.3.32767]",
"System.Net.Primitives": "(,4.3.32767]",
"System.Net.Requests": "(,4.3.32767]",
"System.Net.Security": "(,4.3.32767]",
"System.Net.ServerSentEvents": "(,10.0.32767]",
"System.Net.Sockets": "(,4.3.32767]",
"System.Net.WebHeaderCollection": "(,4.3.32767]",
"System.Net.WebSockets": "(,4.3.32767]",
"System.Net.WebSockets.Client": "(,4.3.32767]",
"System.Numerics.Vectors": "(,5.0.32767]",
"System.ObjectModel": "(,4.3.32767]",
"System.Private.DataContractSerialization": "(,4.3.32767]",
"System.Private.Uri": "(,4.3.32767]",
"System.Reflection": "(,4.3.32767]",
"System.Reflection.DispatchProxy": "(,6.0.32767]",
"System.Reflection.Emit": "(,4.7.32767]",
"System.Reflection.Emit.ILGeneration": "(,4.7.32767]",
"System.Reflection.Emit.Lightweight": "(,4.7.32767]",
"System.Reflection.Extensions": "(,4.3.32767]",
"System.Reflection.Metadata": "(,10.0.32767]",
"System.Reflection.Primitives": "(,4.3.32767]",
"System.Reflection.TypeExtensions": "(,4.3.32767]",
"System.Resources.Reader": "(,4.3.32767]",
"System.Resources.ResourceManager": "(,4.3.32767]",
"System.Resources.Writer": "(,4.3.32767]",
"System.Runtime": "(,4.3.32767]",
"System.Runtime.CompilerServices.Unsafe": "(,7.0.32767]",
"System.Runtime.CompilerServices.VisualC": "(,4.3.32767]",
"System.Runtime.Extensions": "(,4.3.32767]",
"System.Runtime.Handles": "(,4.3.32767]",
"System.Runtime.InteropServices": "(,4.3.32767]",
"System.Runtime.InteropServices.RuntimeInformation": "(,4.3.32767]",
"System.Runtime.Loader": "(,4.3.32767]",
"System.Runtime.Numerics": "(,4.3.32767]",
"System.Runtime.Serialization.Formatters": "(,4.3.32767]",
"System.Runtime.Serialization.Json": "(,4.3.32767]",
"System.Runtime.Serialization.Primitives": "(,4.3.32767]",
"System.Runtime.Serialization.Xml": "(,4.3.32767]",
"System.Security.AccessControl": "(,6.0.32767]",
"System.Security.Claims": "(,4.3.32767]",
"System.Security.Cryptography.Algorithms": "(,4.3.32767]",
"System.Security.Cryptography.Cng": "(,5.0.32767]",
"System.Security.Cryptography.Csp": "(,4.3.32767]",
"System.Security.Cryptography.Encoding": "(,4.3.32767]",
"System.Security.Cryptography.OpenSsl": "(,5.0.32767]",
"System.Security.Cryptography.Primitives": "(,4.3.32767]",
"System.Security.Cryptography.X509Certificates": "(,4.3.32767]",
"System.Security.Principal": "(,4.3.32767]",
"System.Security.Principal.Windows": "(,5.0.32767]",
"System.Security.SecureString": "(,4.3.32767]",
"System.Text.Encoding": "(,4.3.32767]",
"System.Text.Encoding.CodePages": "(,10.0.32767]",
"System.Text.Encoding.Extensions": "(,4.3.32767]",
"System.Text.Encodings.Web": "(,10.0.32767]",
"System.Text.Json": "(,10.0.32767]",
"System.Text.RegularExpressions": "(,4.3.32767]",
"System.Threading": "(,4.3.32767]",
"System.Threading.AccessControl": "(,10.0.32767]",
"System.Threading.Channels": "(,10.0.32767]",
"System.Threading.Overlapped": "(,4.3.32767]",
"System.Threading.Tasks": "(,4.3.32767]",
"System.Threading.Tasks.Dataflow": "(,10.0.32767]",
"System.Threading.Tasks.Extensions": "(,5.0.32767]",
"System.Threading.Tasks.Parallel": "(,4.3.32767]",
"System.Threading.Thread": "(,4.3.32767]",
"System.Threading.ThreadPool": "(,4.3.32767]",
"System.Threading.Timer": "(,4.3.32767]",
"System.ValueTuple": "(,4.5.32767]",
"System.Xml.ReaderWriter": "(,4.3.32767]",
"System.Xml.XDocument": "(,4.3.32767]",
"System.Xml.XmlDocument": "(,4.3.32767]",
"System.Xml.XmlSerializer": "(,4.3.32767]",
"System.Xml.XPath": "(,4.3.32767]",
"System.Xml.XPath.XDocument": "(,5.0.32767]"
}
}
}
}
}
}
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">/Users/einand/.nuget/packages/</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">/Users/einand/.nuget/packages/</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">7.0.0</NuGetToolVersion>
</PropertyGroup>
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<SourceRoot Include="/Users/einand/.nuget/packages/" />
</ItemGroup>
</Project>
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />
+346
View File
@@ -0,0 +1,346 @@
{
"version": 3,
"targets": {
"net10.0": {}
},
"libraries": {},
"projectFileDependencyGroups": {
"net10.0": []
},
"packageFolders": {
"/Users/einand/.nuget/packages/": {}
},
"project": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "/Users/einand/Code/test/csharp/src/print_hej.csproj",
"projectName": "print_hej",
"projectPath": "/Users/einand/Code/test/csharp/src/print_hej.csproj",
"packagesPath": "/Users/einand/.nuget/packages/",
"outputPath": "/Users/einand/Code/test/csharp/src/obj/",
"projectStyle": "PackageReference",
"configFilePaths": [
"/Users/einand/.nuget/NuGet/NuGet.Config"
],
"originalTargetFrameworks": [
"net10.0"
],
"sources": {
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"net10.0": {
"targetAlias": "net10.0",
"projectReferences": {}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
},
"restoreAuditProperties": {
"enableAudit": "true",
"auditLevel": "low",
"auditMode": "all"
},
"SdkAnalysisLevel": "10.0.200"
},
"frameworks": {
"net10.0": {
"targetAlias": "net10.0",
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48",
"net481"
],
"assetTargetFallback": true,
"warn": true,
"frameworkReferences": {
"Microsoft.NETCore.App": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "/usr/local/share/dotnet/sdk/10.0.203/PortableRuntimeIdentifierGraph.json",
"packagesToPrune": {
"Microsoft.CSharp": "(,4.7.32767]",
"Microsoft.VisualBasic": "(,10.4.32767]",
"Microsoft.Win32.Primitives": "(,4.3.32767]",
"Microsoft.Win32.Registry": "(,5.0.32767]",
"runtime.any.System.Collections": "(,4.3.32767]",
"runtime.any.System.Diagnostics.Tools": "(,4.3.32767]",
"runtime.any.System.Diagnostics.Tracing": "(,4.3.32767]",
"runtime.any.System.Globalization": "(,4.3.32767]",
"runtime.any.System.Globalization.Calendars": "(,4.3.32767]",
"runtime.any.System.IO": "(,4.3.32767]",
"runtime.any.System.Reflection": "(,4.3.32767]",
"runtime.any.System.Reflection.Extensions": "(,4.3.32767]",
"runtime.any.System.Reflection.Primitives": "(,4.3.32767]",
"runtime.any.System.Resources.ResourceManager": "(,4.3.32767]",
"runtime.any.System.Runtime": "(,4.3.32767]",
"runtime.any.System.Runtime.Handles": "(,4.3.32767]",
"runtime.any.System.Runtime.InteropServices": "(,4.3.32767]",
"runtime.any.System.Text.Encoding": "(,4.3.32767]",
"runtime.any.System.Text.Encoding.Extensions": "(,4.3.32767]",
"runtime.any.System.Threading.Tasks": "(,4.3.32767]",
"runtime.any.System.Threading.Timer": "(,4.3.32767]",
"runtime.aot.System.Collections": "(,4.3.32767]",
"runtime.aot.System.Diagnostics.Tools": "(,4.3.32767]",
"runtime.aot.System.Diagnostics.Tracing": "(,4.3.32767]",
"runtime.aot.System.Globalization": "(,4.3.32767]",
"runtime.aot.System.Globalization.Calendars": "(,4.3.32767]",
"runtime.aot.System.IO": "(,4.3.32767]",
"runtime.aot.System.Reflection": "(,4.3.32767]",
"runtime.aot.System.Reflection.Extensions": "(,4.3.32767]",
"runtime.aot.System.Reflection.Primitives": "(,4.3.32767]",
"runtime.aot.System.Resources.ResourceManager": "(,4.3.32767]",
"runtime.aot.System.Runtime": "(,4.3.32767]",
"runtime.aot.System.Runtime.Handles": "(,4.3.32767]",
"runtime.aot.System.Runtime.InteropServices": "(,4.3.32767]",
"runtime.aot.System.Text.Encoding": "(,4.3.32767]",
"runtime.aot.System.Text.Encoding.Extensions": "(,4.3.32767]",
"runtime.aot.System.Threading.Tasks": "(,4.3.32767]",
"runtime.aot.System.Threading.Timer": "(,4.3.32767]",
"runtime.debian.8-x64.runtime.native.System": "(,4.3.32767]",
"runtime.debian.8-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.debian.8-x64.runtime.native.System.Net.Http": "(,4.3.32767]",
"runtime.debian.8-x64.runtime.native.System.Net.Security": "(,4.3.32767]",
"runtime.debian.8-x64.runtime.native.System.Security.Cryptography": "(,4.3.32767]",
"runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl": "(,4.3.32767]",
"runtime.debian.9-x64.runtime.native.System": "(,4.3.32767]",
"runtime.debian.9-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.debian.9-x64.runtime.native.System.Net.Http": "(,4.3.32767]",
"runtime.debian.9-x64.runtime.native.System.Net.Security": "(,4.3.32767]",
"runtime.fedora.23-x64.runtime.native.System": "(,4.3.32767]",
"runtime.fedora.23-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.fedora.23-x64.runtime.native.System.Net.Http": "(,4.3.32767]",
"runtime.fedora.23-x64.runtime.native.System.Net.Security": "(,4.3.32767]",
"runtime.fedora.23-x64.runtime.native.System.Security.Cryptography": "(,4.3.32767]",
"runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl": "(,4.3.32767]",
"runtime.fedora.24-x64.runtime.native.System": "(,4.3.32767]",
"runtime.fedora.24-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.fedora.24-x64.runtime.native.System.Net.Http": "(,4.3.32767]",
"runtime.fedora.24-x64.runtime.native.System.Net.Security": "(,4.3.32767]",
"runtime.fedora.24-x64.runtime.native.System.Security.Cryptography": "(,4.3.32767]",
"runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl": "(,4.3.32767]",
"runtime.fedora.27-x64.runtime.native.System": "(,4.3.32767]",
"runtime.fedora.27-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.fedora.27-x64.runtime.native.System.Net.Http": "(,4.3.32767]",
"runtime.fedora.27-x64.runtime.native.System.Net.Security": "(,4.3.32767]",
"runtime.fedora.28-x64.runtime.native.System": "(,4.3.32767]",
"runtime.fedora.28-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.fedora.28-x64.runtime.native.System.Net.Http": "(,4.3.32767]",
"runtime.fedora.28-x64.runtime.native.System.Net.Security": "(,4.3.32767]",
"runtime.opensuse.13.2-x64.runtime.native.System": "(,4.3.32767]",
"runtime.opensuse.13.2-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.opensuse.13.2-x64.runtime.native.System.Net.Http": "(,4.3.32767]",
"runtime.opensuse.13.2-x64.runtime.native.System.Net.Security": "(,4.3.32767]",
"runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography": "(,4.3.32767]",
"runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl": "(,4.3.32767]",
"runtime.opensuse.42.1-x64.runtime.native.System": "(,4.3.32767]",
"runtime.opensuse.42.1-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.opensuse.42.1-x64.runtime.native.System.Net.Http": "(,4.3.32767]",
"runtime.opensuse.42.1-x64.runtime.native.System.Net.Security": "(,4.3.32767]",
"runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography": "(,4.3.32767]",
"runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl": "(,4.3.32767]",
"runtime.opensuse.42.3-x64.runtime.native.System": "(,4.3.32767]",
"runtime.opensuse.42.3-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.opensuse.42.3-x64.runtime.native.System.Net.Http": "(,4.3.32767]",
"runtime.opensuse.42.3-x64.runtime.native.System.Net.Security": "(,4.3.32767]",
"runtime.osx.10.10-x64.runtime.native.System": "(,4.3.32767]",
"runtime.osx.10.10-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.osx.10.10-x64.runtime.native.System.Net.Http": "(,4.3.32767]",
"runtime.osx.10.10-x64.runtime.native.System.Net.Security": "(,4.3.32767]",
"runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography": "(,4.3.32767]",
"runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple": "(,4.3.32767]",
"runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl": "(,4.3.32767]",
"runtime.rhel.7-x64.runtime.native.System": "(,4.3.32767]",
"runtime.rhel.7-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.rhel.7-x64.runtime.native.System.Net.Http": "(,4.3.32767]",
"runtime.rhel.7-x64.runtime.native.System.Net.Security": "(,4.3.32767]",
"runtime.rhel.7-x64.runtime.native.System.Security.Cryptography": "(,4.3.32767]",
"runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl": "(,4.3.32767]",
"runtime.ubuntu.14.04-x64.runtime.native.System": "(,4.3.32767]",
"runtime.ubuntu.14.04-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.ubuntu.14.04-x64.runtime.native.System.Net.Http": "(,4.3.32767]",
"runtime.ubuntu.14.04-x64.runtime.native.System.Net.Security": "(,4.3.32767]",
"runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography": "(,4.3.32767]",
"runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": "(,4.3.32767]",
"runtime.ubuntu.16.04-x64.runtime.native.System": "(,4.3.32767]",
"runtime.ubuntu.16.04-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.ubuntu.16.04-x64.runtime.native.System.Net.Http": "(,4.3.32767]",
"runtime.ubuntu.16.04-x64.runtime.native.System.Net.Security": "(,4.3.32767]",
"runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography": "(,4.3.32767]",
"runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": "(,4.3.32767]",
"runtime.ubuntu.16.10-x64.runtime.native.System": "(,4.3.32767]",
"runtime.ubuntu.16.10-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.ubuntu.16.10-x64.runtime.native.System.Net.Http": "(,4.3.32767]",
"runtime.ubuntu.16.10-x64.runtime.native.System.Net.Security": "(,4.3.32767]",
"runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography": "(,4.3.32767]",
"runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl": "(,4.3.32767]",
"runtime.ubuntu.18.04-x64.runtime.native.System": "(,4.3.32767]",
"runtime.ubuntu.18.04-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.ubuntu.18.04-x64.runtime.native.System.Net.Http": "(,4.3.32767]",
"runtime.ubuntu.18.04-x64.runtime.native.System.Net.Security": "(,4.3.32767]",
"runtime.unix.Microsoft.Win32.Primitives": "(,4.3.32767]",
"runtime.unix.System.Console": "(,4.3.32767]",
"runtime.unix.System.Diagnostics.Debug": "(,4.3.32767]",
"runtime.unix.System.IO.FileSystem": "(,4.3.32767]",
"runtime.unix.System.Net.Primitives": "(,4.3.32767]",
"runtime.unix.System.Net.Sockets": "(,4.3.32767]",
"runtime.unix.System.Private.Uri": "(,4.3.32767]",
"runtime.unix.System.Runtime.Extensions": "(,4.3.32767]",
"runtime.win.Microsoft.Win32.Primitives": "(,4.3.32767]",
"runtime.win.System.Console": "(,4.3.32767]",
"runtime.win.System.Diagnostics.Debug": "(,4.3.32767]",
"runtime.win.System.IO.FileSystem": "(,4.3.32767]",
"runtime.win.System.Net.Primitives": "(,4.3.32767]",
"runtime.win.System.Net.Sockets": "(,4.3.32767]",
"runtime.win.System.Runtime.Extensions": "(,4.3.32767]",
"runtime.win10-arm-aot.runtime.native.System.IO.Compression": "(,4.0.32767]",
"runtime.win10-arm64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.win10-x64-aot.runtime.native.System.IO.Compression": "(,4.0.32767]",
"runtime.win10-x86-aot.runtime.native.System.IO.Compression": "(,4.0.32767]",
"runtime.win7-x64.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.win7-x86.runtime.native.System.IO.Compression": "(,4.3.32767]",
"runtime.win7.System.Private.Uri": "(,4.3.32767]",
"runtime.win8-arm.runtime.native.System.IO.Compression": "(,4.3.32767]",
"System.AppContext": "(,4.3.32767]",
"System.Buffers": "(,5.0.32767]",
"System.Collections": "(,4.3.32767]",
"System.Collections.Concurrent": "(,4.3.32767]",
"System.Collections.Immutable": "(,10.0.32767]",
"System.Collections.NonGeneric": "(,4.3.32767]",
"System.Collections.Specialized": "(,4.3.32767]",
"System.ComponentModel": "(,4.3.32767]",
"System.ComponentModel.Annotations": "(,4.3.32767]",
"System.ComponentModel.EventBasedAsync": "(,4.3.32767]",
"System.ComponentModel.Primitives": "(,4.3.32767]",
"System.ComponentModel.TypeConverter": "(,4.3.32767]",
"System.Console": "(,4.3.32767]",
"System.Data.Common": "(,4.3.32767]",
"System.Data.DataSetExtensions": "(,4.4.32767]",
"System.Diagnostics.Contracts": "(,4.3.32767]",
"System.Diagnostics.Debug": "(,4.3.32767]",
"System.Diagnostics.DiagnosticSource": "(,10.0.32767]",
"System.Diagnostics.FileVersionInfo": "(,4.3.32767]",
"System.Diagnostics.Process": "(,4.3.32767]",
"System.Diagnostics.StackTrace": "(,4.3.32767]",
"System.Diagnostics.TextWriterTraceListener": "(,4.3.32767]",
"System.Diagnostics.Tools": "(,4.3.32767]",
"System.Diagnostics.TraceSource": "(,4.3.32767]",
"System.Diagnostics.Tracing": "(,4.3.32767]",
"System.Drawing.Primitives": "(,4.3.32767]",
"System.Dynamic.Runtime": "(,4.3.32767]",
"System.Formats.Asn1": "(,10.0.32767]",
"System.Formats.Tar": "(,10.0.32767]",
"System.Globalization": "(,4.3.32767]",
"System.Globalization.Calendars": "(,4.3.32767]",
"System.Globalization.Extensions": "(,4.3.32767]",
"System.IO": "(,4.3.32767]",
"System.IO.Compression": "(,4.3.32767]",
"System.IO.Compression.ZipFile": "(,4.3.32767]",
"System.IO.FileSystem": "(,4.3.32767]",
"System.IO.FileSystem.AccessControl": "(,4.4.32767]",
"System.IO.FileSystem.DriveInfo": "(,4.3.32767]",
"System.IO.FileSystem.Primitives": "(,4.3.32767]",
"System.IO.FileSystem.Watcher": "(,4.3.32767]",
"System.IO.IsolatedStorage": "(,4.3.32767]",
"System.IO.MemoryMappedFiles": "(,4.3.32767]",
"System.IO.Pipelines": "(,10.0.32767]",
"System.IO.Pipes": "(,4.3.32767]",
"System.IO.Pipes.AccessControl": "(,5.0.32767]",
"System.IO.UnmanagedMemoryStream": "(,4.3.32767]",
"System.Linq": "(,4.3.32767]",
"System.Linq.AsyncEnumerable": "(,10.0.32767]",
"System.Linq.Expressions": "(,4.3.32767]",
"System.Linq.Parallel": "(,4.3.32767]",
"System.Linq.Queryable": "(,4.3.32767]",
"System.Memory": "(,5.0.32767]",
"System.Net.Http": "(,4.3.32767]",
"System.Net.Http.Json": "(,10.0.32767]",
"System.Net.NameResolution": "(,4.3.32767]",
"System.Net.NetworkInformation": "(,4.3.32767]",
"System.Net.Ping": "(,4.3.32767]",
"System.Net.Primitives": "(,4.3.32767]",
"System.Net.Requests": "(,4.3.32767]",
"System.Net.Security": "(,4.3.32767]",
"System.Net.ServerSentEvents": "(,10.0.32767]",
"System.Net.Sockets": "(,4.3.32767]",
"System.Net.WebHeaderCollection": "(,4.3.32767]",
"System.Net.WebSockets": "(,4.3.32767]",
"System.Net.WebSockets.Client": "(,4.3.32767]",
"System.Numerics.Vectors": "(,5.0.32767]",
"System.ObjectModel": "(,4.3.32767]",
"System.Private.DataContractSerialization": "(,4.3.32767]",
"System.Private.Uri": "(,4.3.32767]",
"System.Reflection": "(,4.3.32767]",
"System.Reflection.DispatchProxy": "(,6.0.32767]",
"System.Reflection.Emit": "(,4.7.32767]",
"System.Reflection.Emit.ILGeneration": "(,4.7.32767]",
"System.Reflection.Emit.Lightweight": "(,4.7.32767]",
"System.Reflection.Extensions": "(,4.3.32767]",
"System.Reflection.Metadata": "(,10.0.32767]",
"System.Reflection.Primitives": "(,4.3.32767]",
"System.Reflection.TypeExtensions": "(,4.3.32767]",
"System.Resources.Reader": "(,4.3.32767]",
"System.Resources.ResourceManager": "(,4.3.32767]",
"System.Resources.Writer": "(,4.3.32767]",
"System.Runtime": "(,4.3.32767]",
"System.Runtime.CompilerServices.Unsafe": "(,7.0.32767]",
"System.Runtime.CompilerServices.VisualC": "(,4.3.32767]",
"System.Runtime.Extensions": "(,4.3.32767]",
"System.Runtime.Handles": "(,4.3.32767]",
"System.Runtime.InteropServices": "(,4.3.32767]",
"System.Runtime.InteropServices.RuntimeInformation": "(,4.3.32767]",
"System.Runtime.Loader": "(,4.3.32767]",
"System.Runtime.Numerics": "(,4.3.32767]",
"System.Runtime.Serialization.Formatters": "(,4.3.32767]",
"System.Runtime.Serialization.Json": "(,4.3.32767]",
"System.Runtime.Serialization.Primitives": "(,4.3.32767]",
"System.Runtime.Serialization.Xml": "(,4.3.32767]",
"System.Security.AccessControl": "(,6.0.32767]",
"System.Security.Claims": "(,4.3.32767]",
"System.Security.Cryptography.Algorithms": "(,4.3.32767]",
"System.Security.Cryptography.Cng": "(,5.0.32767]",
"System.Security.Cryptography.Csp": "(,4.3.32767]",
"System.Security.Cryptography.Encoding": "(,4.3.32767]",
"System.Security.Cryptography.OpenSsl": "(,5.0.32767]",
"System.Security.Cryptography.Primitives": "(,4.3.32767]",
"System.Security.Cryptography.X509Certificates": "(,4.3.32767]",
"System.Security.Principal": "(,4.3.32767]",
"System.Security.Principal.Windows": "(,5.0.32767]",
"System.Security.SecureString": "(,4.3.32767]",
"System.Text.Encoding": "(,4.3.32767]",
"System.Text.Encoding.CodePages": "(,10.0.32767]",
"System.Text.Encoding.Extensions": "(,4.3.32767]",
"System.Text.Encodings.Web": "(,10.0.32767]",
"System.Text.Json": "(,10.0.32767]",
"System.Text.RegularExpressions": "(,4.3.32767]",
"System.Threading": "(,4.3.32767]",
"System.Threading.AccessControl": "(,10.0.32767]",
"System.Threading.Channels": "(,10.0.32767]",
"System.Threading.Overlapped": "(,4.3.32767]",
"System.Threading.Tasks": "(,4.3.32767]",
"System.Threading.Tasks.Dataflow": "(,10.0.32767]",
"System.Threading.Tasks.Extensions": "(,5.0.32767]",
"System.Threading.Tasks.Parallel": "(,4.3.32767]",
"System.Threading.Thread": "(,4.3.32767]",
"System.Threading.ThreadPool": "(,4.3.32767]",
"System.Threading.Timer": "(,4.3.32767]",
"System.ValueTuple": "(,4.5.32767]",
"System.Xml.ReaderWriter": "(,4.3.32767]",
"System.Xml.XDocument": "(,4.3.32767]",
"System.Xml.XmlDocument": "(,4.3.32767]",
"System.Xml.XmlSerializer": "(,4.3.32767]",
"System.Xml.XPath": "(,4.3.32767]",
"System.Xml.XPath.XDocument": "(,5.0.32767]"
}
}
}
}
}
+8
View File
@@ -0,0 +1,8 @@
{
"version": 2,
"dgSpecHash": "XRC1hwC/Ajc=",
"success": true,
"projectFilePath": "/Users/einand/Code/test/csharp/src/print_hej.csproj",
"expectedPackageFiles": [],
"logs": []
}
+66
View File
@@ -0,0 +1,66 @@
using System;
using System.Numerics;
class Program
{
static void Main(string[] args)
{
int decimals = 100;
if (args.Length > 0)
{
if (!int.TryParse(args[0], out decimals) || decimals <= 0)
decimals = 100;
}
BigInteger pi = CalculatePi(decimals);
Console.WriteLine(FormatPi(pi, decimals));
}
// Calculate arctan(1/x) using Taylor series
static BigInteger Arctan(int x, int decimals)
{
BigInteger scale = BigInteger.Pow(10, decimals + 10);
BigInteger xBig = new BigInteger(x);
BigInteger xSquared = xBig * xBig;
BigInteger result = BigInteger.Zero;
BigInteger term = scale / xBig;
int n = 0;
while (term != 0 && n < decimals * 3)
{
BigInteger divisor = new BigInteger(2 * n + 1);
BigInteger contrib = term / divisor;
if (n % 2 == 0)
result += contrib;
else
result -= contrib;
term /= xSquared;
n++;
if (n > decimals * 2) break;
}
return result;
}
// Calculate pi using Machin's formula
static BigInteger CalculatePi(int decimals)
{
BigInteger atan1_5 = Arctan(5, decimals);
BigInteger atan1_239 = Arctan(239, decimals);
return 16 * atan1_5 - 4 * atan1_239;
}
// Format pi with decimal point
static string FormatPi(BigInteger pi, int decimals)
{
string piStr = pi.ToString();
while (piStr.Length < decimals + 10)
piStr = "0" + piStr;
return "3." + piStr.Substring(1, decimals);
}
}
+11
View File
@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<Compile Remove="PiTests.cs" />
</ItemGroup>
</Project>
Executable
+23
View File
@@ -0,0 +1,23 @@
#!/bin/bash
# D Build Script
SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
cd "$SCRIPT_DIR"
echo "=== D Build ==="
echo ""
# Kompilera D-programmet
ldc2 -of bin/print_hej src/print_hej.d
if [ $? -eq 0 ]; then
echo "✓ Kompilering lyckades!"
echo "Binär: bin/print_hej"
echo ""
echo "För att köra:"
echo " ./bin/print_hej [decimaler]"
else
echo "✗ Kompilering misslyckades!"
exit 1
fi
Executable
+19
View File
@@ -0,0 +1,19 @@
#!/bin/bash
# D Unit Tests
SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
cd "$SCRIPT_DIR"
echo "=== D Pi-beräkning Unit Tester ==="
echo ""
# Kompilera och kör pi_test
ldc2 -o bin/pi_test src/pi_test.d
if [ $? -eq 0 ]; then
./bin/pi_test
exit $?
else
echo "✗ Kompilering av tester misslyckades!"
exit 1
fi
+30
View File
@@ -0,0 +1,30 @@
#!/bin/bash
# Dart Build Script
SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
cd "$SCRIPT_DIR"
echo "=== Dart Build ==="
echo ""
# Check for dart
if ! command -v dart &> /dev/null; then
echo "✗ Dart-kompilator hittades inte!"
echo " Installera Dart: brew install dart"
exit 1
fi
echo "Använder: dart"
# Compile to native executable
if dart compile exe src/print_hej.dart -o bin/print_hej 2>&1; then
echo "✓ Kompilering lyckades!"
echo " Executable: bin/print_hej"
echo ""
echo "För att köra:"
echo " ./bin/print_hej <decimaler>"
else
echo "✗ Kompilering misslyckades!"
exit 1
fi
+71
View File
@@ -0,0 +1,71 @@
import 'dart:io';
// Calculate arctan(1/x) using Taylor series
// arctan(1/x) = 1/x - 1/(3*x^3) + 1/(5*x^5) - ...
BigInt arctan(int x, int decimals) {
BigInt scale = BigInt.from(10).pow(decimals + 10);
BigInt xBig = BigInt.from(x);
BigInt xSquared = xBig * xBig;
BigInt term = scale ~/ xBig;
BigInt result = BigInt.zero;
int n = 0;
while (term != BigInt.zero && n < decimals * 3) {
BigInt divisor = BigInt.from(2 * n + 1);
BigInt contrib = term ~/ divisor;
if (n % 2 == 0) {
result += contrib;
} else {
result -= contrib;
}
term = term ~/ xSquared;
n++;
}
return result;
}
BigInt calculatePi(int decimals) {
BigInt atan1_5 = arctan(5, decimals);
BigInt atan1_239 = arctan(239, decimals);
// pi = 16*arctan(1/5) - 4*arctan(1/239)
return atan1_5 * BigInt.from(16) - atan1_239 * BigInt.from(4);
}
void main(List<String> args) {
int decimals = 100;
if (args.isNotEmpty) {
try {
decimals = int.parse(args[0]);
if (decimals < 1) decimals = 100;
} catch (e) {
decimals = 100;
}
}
BigInt pi = calculatePi(decimals);
String piStr = pi.toString();
// Print with decimal point
stdout.write('3.');
int startIndex = 1;
int endIndex = startIndex + decimals;
if (endIndex > piStr.length) {
endIndex = piStr.length;
}
stdout.write(piStr.substring(startIndex, endIndex));
// Pad with zeros if needed
for (int i = 0; i < decimals - (endIndex - startIndex); i++) {
stdout.write('0');
}
print('');
}
+29
View File
@@ -0,0 +1,29 @@
#!/bin/bash
# Elixir Build Script
SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
cd "$SCRIPT_DIR"
echo "=== Elixir Build ==="
echo ""
# Elixir är ett interpreterat språk, ingen kompilering behövs
# Skapa wrapper script
mkdir -p bin
cat > bin/print_hej << 'EOF'
#!/bin/bash
SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
cd "$SCRIPT_DIR"
elixir src/print_hej.exs "$@"
EOF
chmod +x bin/print_hej
echo "✓ Ingen kompilering behövs för Elixir"
echo " Använder Elixir interpreter"
echo ""
echo "Wrapper script skapad: bin/print_hej"
echo ""
echo "För att köra:"
echo " ./bin/print_hej [decimaler]"
+19
View File
@@ -0,0 +1,19 @@
#!/bin/bash
# Elixir Test Script
SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
cd "$SCRIPT_DIR"
echo "=== Elixir Test ==="
echo ""
# Testa pi-beräkning med olika antal decimaler
for decimals in 1 2 5 10 100; do
result=$(./bin/print_hej $decimals 2>/dev/null)
if [ $? -eq 0 ]; then
echo "$decimals decimaler: $result"
else
echo "$decimals decimaler misslyckades"
fi
done
+108
View File
@@ -0,0 +1,108 @@
# Pi calculation using Machin's formula
# pi/4 = 4*arctan(1/5) - arctan(1/239)
defmodule PiCalculator do
# Calculate arctan(1/x) using Taylor series with arbitrary precision
# arctan(1/x) = 1/x - 1/(3*x^3) + 1/(5*x^5) - ...
def arctan(x, decimals) do
# Use integer power to avoid float precision loss
scale = power(10, decimals + 10)
x_squared = x * x
# Taylor series: arctan(1/x) = sum((-1)^n * 1/((2n+1) * x^(2n+1)))
# We compute this iteratively:
# term_0 = scale / x (represents 1/x with scale factor)
# For each n:
# contrib = term / (2n+1)
# result += sign * contrib
# term = term / x²
# sign = -sign
term = div(scale, x)
compute(x_squared, term, 0, 0, true, decimals * 3)
end
# Calculate 10^n using integer arithmetic
defp power(10, n) when n >= 0 do
Integer.pow(10, n)
end
defp compute(_x_squared, 0, result, _n, _sign, _max_iterations), do: result
defp compute(_x_squared, _term, result, n, _sign, max_iterations) when n >= max_iterations, do: result
defp compute(x_squared, term, result, n, sign, max_iterations) do
divisor = 2 * n + 1
# Only compute if divisor > 0
if divisor > 0 do
contrib = div(term, divisor)
new_result = if sign do
result + contrib
else
result - contrib
end
new_term = div(term, x_squared)
compute(x_squared, new_term, new_result, n + 1, not sign, max_iterations)
else
result
end
end
# Calculate pi using Machin's formula
def calculate_pi(decimals) do
actual_decimals = if decimals < 1, do: 100, else: decimals
# Machin's formula: pi/4 = 4*arctan(1/5) - arctan(1/239)
# pi = 16*arctan(1/5) - 4*arctan(1/239)
arctan5 = arctan(5, actual_decimals)
arctan239 = arctan(239, actual_decimals)
pi = 16 * arctan5 - 4 * arctan239
# Format output
pi_str = Integer.to_string(pi)
if actual_decimals == 0 do
"3"
else
# Pad with zeros if needed
padded = if String.length(pi_str) < actual_decimals + 1 do
zeros_needed = actual_decimals + 1 - String.length(pi_str)
String.duplicate("0", zeros_needed) <> pi_str
else
pi_str
end
# Insert decimal point
before_decimal = String.slice(padded, 0, 1)
after_decimal = String.slice(padded, 1..-1//1)
# Pad or truncate to desired length
final_after_decimal = if String.length(after_decimal) < actual_decimals do
after_decimal <> String.duplicate("0", actual_decimals - String.length(after_decimal))
else
String.slice(after_decimal, 0, actual_decimals)
end
"#{before_decimal}.#{final_after_decimal}"
end
end
def main(args) do
decimals = case args do
[d | _] ->
case Integer.parse(d) do
{n, _} when n > 0 -> n
_ -> 100
end
[] -> 100
end
IO.puts(calculate_pi(decimals))
end
end
# Run with: elixir print_hej.exs [decimals]
PiCalculator.main(System.argv())
+37
View File
@@ -0,0 +1,37 @@
#!/bin/bash
# Erlang Build Script
SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
cd "$SCRIPT_DIR"
echo "=== Erlang Build ==="
echo ""
# Kompilera Erlang-programmet
cd src
erlc print_hej.erl
if [ $? -eq 0 ]; then
echo "✓ Kompilering lyckades!"
echo "Beam: src/print_hej.beam"
echo ""
# Skapa wrapper script
mkdir -p ../bin
cat > ../bin/print_hej << 'EOF'
#!/bin/bash
SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
cd "$SCRIPT_DIR"
erl -noshell -pa src -eval "print_hej:main([\"$1\"])" -s init stop
EOF
chmod +x ../bin/print_hej
echo "Wrapper script skapad: bin/print_hej"
echo ""
echo "För att köra:"
echo " ./bin/print_hej [decimaler]"
else
echo "✗ Kompilering misslyckades!"
exit 1
fi
+15
View File
@@ -0,0 +1,15 @@
#!/bin/bash
# Erlang Unit Tests
SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
cd "$SCRIPT_DIR"
echo "=== Erlang Pi-beräkning Unit Tester ==="
echo ""
cd src
erlc pi_test.erl
erl -noshell -eval "pi_test:test()" -s init stop
exit $?
+65
View File
@@ -0,0 +1,65 @@
-module(pi_test).
-include_lib("eunit/include/eunit.hrl").
-define(SCRIPT_PATH, "/Users/einand/Code/test/erlang/print_hej").
run_script(Args) ->
Cmd = ?SCRIPT_PATH ++ " " ++ Args,
Port = open_port({spawn, Cmd}, [stream, exit_status]),
receive
{Port, {data, Output}} ->
port_close(Port),
string:trim(Output, trailing, "\n");
{Port, {exit_status, _Status}} ->
port_close(Port),
""
after 5000 ->
port_close(Port),
""
end.
run_script_no_args() ->
Cmd = ?SCRIPT_PATH,
Port = open_port({spawn, Cmd}, [stream, exit_status]),
receive
{Port, {data, Output}} ->
port_close(Port),
string:trim(Output, trailing, "\n");
{Port, {exit_status, _Status}} ->
port_close(Port),
""
after 5000 ->
port_close(Port),
""
end.
test_10_decimals_test() ->
Result = run_script("10"),
Expected = "3.1415926535",
?assertEqual(Expected, Result).
test_5_decimals_test() ->
Result = run_script("5"),
Expected = "3.14159",
?assertEqual(Expected, Result).
test_1_decimal_test() ->
Result = run_script("1"),
Expected = "3.1",
?assertEqual(Expected, Result).
test_100_decimals_test() ->
Result = run_script("100"),
Expected = "3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679",
?assertEqual(Expected, Result).
test_default_100_decimals_test() ->
Result = run_script_no_args(),
Expected = "3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679",
?assertEqual(Expected, Result).
test_10000_decimals_test() ->
Result = run_script("10000"),
% Check length: "3." + 10000 digits = 10002 characters
?assertEqual(10002, length(Result)),
?assert(lists:prefix("3.14159", Result)).
+64
View File
@@ -0,0 +1,64 @@
-module(print_hej).
-export([main/1, pow/2]).
main(Args) ->
Decimals = case Args of
[] -> 100;
[X | _] ->
case string:to_integer(X) of
{D, _} when D > 0 -> D;
_ -> 100
end
end,
Pi = calculate_pi(Decimals),
PiStr = format_pi(Pi, Decimals),
io:format("~s~n", [PiStr]),
erlang:halt(0).
% Calculate arctan(1/x) using Taylor series
% arctan(1/x) = 1/x - 1/(3*x^3) + 1/(5*x^5) - ...
arctan(X, Decimals) ->
Scale = pow(10, Decimals + 10),
XSquared = X * X,
Term = Scale div X, % First term: scale / x
arctan_iter(XSquared, Term, 0, 0, Decimals).
arctan_iter(_XSquared, Term, N, Result, Decimals) when Term == 0; N > Decimals * 3 ->
Result;
arctan_iter(XSquared, Term, N, Result, Decimals) ->
Divisor = 2 * N + 1,
Contrib = Term div Divisor,
NewResult = case N rem 2 of
0 -> Result + Contrib;
1 -> Result - Contrib
end,
NewTerm = Term div XSquared, % Divide by x² each iteration
arctan_iter(XSquared, NewTerm, N + 1, NewResult, Decimals).
% Calculate pi using Machin's formula
% pi/4 = 4*arctan(1/5) - arctan(1/239)
calculate_pi(Decimals) ->
Atan1_5 = arctan(5, Decimals),
Atan1_239 = arctan(239, Decimals),
16 * Atan1_5 - 4 * Atan1_239.
% Format pi with decimal point
format_pi(Pi, Decimals) ->
PiStr = integer_to_list(Pi),
% Pad with leading zeros if needed
PiStr2 = case length(PiStr) < Decimals + 10 of
true -> string:left(PiStr, Decimals + 10, $0);
false -> PiStr
end,
"3." ++ string:substr(PiStr2, 2, Decimals).
% Power function for integers
pow(Base, Exp) when Exp >= 0 ->
pow_iter(Base, Exp, 1).
pow_iter(_Base, 0, Acc) -> Acc;
pow_iter(Base, Exp, Acc) when Exp rem 2 == 0 ->
pow_iter(Base * Base, Exp div 2, Acc);
pow_iter(Base, Exp, Acc) ->
pow_iter(Base, Exp - 1, Acc * Base).
+1
View File
File diff suppressed because one or more lines are too long
+36
View File
@@ -0,0 +1,36 @@
#!/bin/bash
# Fortran Build Script
SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
cd "$SCRIPT_DIR"
echo "=== Fortran Build ==="
echo ""
# Check for gfortran
if command -v gfortran &> /dev/null; then
FC=gfortran
elif command -v f95 &> /dev/null; then
FC=f95
elif command -v f90 &> /dev/null; then
FC=f90
else
echo "✗ Ingen Fortran-kompilator hittades!"
echo " Installera gfortran: brew install gcc"
exit 1
fi
echo "Använder: $FC"
# Compile
if $FC -O2 -o bin/print_hej src/print_hej.f90 2>&1; then
echo "✓ Kompilering lyckades!"
echo " Executable: bin/print_hej"
echo ""
echo "För att köra:"
echo " ./bin/print_hej [decimaler]"
else
echo "✗ Kompilering misslyckades!"
exit 1
fi
+157
View File
@@ -0,0 +1,157 @@
! Pi Calculator using Machin's Formula
! pi/4 = 4*arctan(1/5) - arctan(1/239)
program pi_calculator
implicit none
integer :: decimals, argc, i, n
character(len=32) :: arg
integer, allocatable :: pi(:), a(:), b(:), term(:), contrib(:)
integer :: scale_len
integer :: carry, rem, x_sq, divisor
argc = command_argument_count()
if (argc > 0) then
call get_command_argument(1, arg)
read(arg, *) decimals
else
decimals = 100
end if
if (decimals <= 0) decimals = 100
scale_len = decimals + 20
allocate(pi(scale_len))
allocate(a(scale_len))
allocate(b(scale_len))
allocate(term(scale_len))
allocate(contrib(scale_len))
! Initialize
pi = 0
a = 0
b = 0
! Calculate arctan(1/5) -> a
call arctan(5, a, scale_len)
! Calculate arctan(1/239) -> b
call arctan(239, b, scale_len)
! pi = 16*a - 4*b
! First multiply a by 16
carry = 0
do i = scale_len, 1, -1
pi(i) = a(i) * 16 + carry
carry = pi(i) / 10
pi(i) = mod(pi(i), 10)
end do
! Then multiply b by 4
carry = 0
do i = scale_len, 1, -1
b(i) = b(i) * 4 + carry
carry = b(i) / 10
b(i) = mod(b(i), 10)
end do
! Then subtract b from pi
carry = 0
do i = scale_len, 1, -1
pi(i) = pi(i) - b(i) - carry
if (pi(i) < 0) then
pi(i) = pi(i) + 10
carry = 1
else
carry = 0
end if
end do
! Print result
write(*, '(A)', advance='no') '3.'
do i = 2, decimals + 1
write(*, '(I1)', advance='no') pi(i)
end do
write(*, *)
deallocate(pi, a, b, term, contrib)
contains
subroutine arctan(x, result, len)
integer, intent(in) :: x, len
integer, intent(out) :: result(len)
integer :: n, i
integer :: term(len), contrib(len)
integer :: rem, x_sq, divisor, carry_local
logical :: term_zero
result = 0
term = 0
term(1) = 1
! term = 10^len / x
rem = 0
do i = 1, len
rem = rem * 10 + term(i)
term(i) = rem / x
rem = mod(rem, x)
end do
x_sq = x * x
n = 0
do while (n < len * 3)
divisor = 2 * n + 1
! contrib = term / divisor
rem = 0
do i = 1, len
rem = rem * 10 + term(i)
contrib(i) = rem / divisor
rem = mod(rem, divisor)
end do
! result = result +/- contrib
if (mod(n, 2) == 0) then
! result = result + contrib
carry_local = 0
do i = len, 1, -1
result(i) = result(i) + contrib(i) + carry_local
carry_local = result(i) / 10
result(i) = mod(result(i), 10)
end do
else
! result = result - contrib
carry_local = 0
do i = len, 1, -1
result(i) = result(i) - contrib(i) - carry_local
if (result(i) < 0) then
result(i) = result(i) + 10
carry_local = 1
else
carry_local = 0
end if
end do
end if
! term = term / x^2
rem = 0
do i = 1, len
rem = rem * 10 + term(i)
term(i) = rem / x_sq
rem = mod(rem, x_sq)
end do
! Check if term is zero
term_zero = .true.
do i = 1, len
if (term(i) /= 0) then
term_zero = .false.
exit
end if
end do
if (term_zero) exit
n = n + 1
end do
end subroutine arctan
end program pi_calculator
+24
View File
@@ -0,0 +1,24 @@
#!/bin/bash
# Go Build Script
SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
cd "$SCRIPT_DIR"
echo "=== Go Build ==="
echo ""
# Kompilera Go-programmet
cd src
go build -o ../bin/print_hej print_hej.go
if [ $? -eq 0 ]; then
echo "✓ Kompilering lyckades!"
echo "Binär: bin/print_hej"
echo ""
echo "För att köra:"
echo " ./bin/print_hej [decimaler]"
else
echo "✗ Kompilering misslyckades!"
exit 1
fi
Executable
+14
View File
@@ -0,0 +1,14 @@
#!/bin/bash
# Go Unit Tests
SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
cd "$SCRIPT_DIR"
echo "=== Go Pi-beräkning Unit Tester ==="
echo ""
cd src
go test -v
exit $?
+3
View File
@@ -0,0 +1,3 @@
module print_hej
go 1.21
+73
View File
@@ -0,0 +1,73 @@
package main
import (
"os/exec"
"strings"
"testing"
)
const scriptPath = "/Users/einand/Code/test/go/print_hej"
func runScript(decimals ...int) string {
args := []string{}
if len(decimals) > 0 {
args = append(args, string(rune(decimals[0])))
}
cmd := exec.Command(scriptPath, args...)
output, err := cmd.Output()
if err != nil {
panic(err)
}
return strings.TrimSpace(string(output))
}
func Test10Decimals(t *testing.T) {
result := runScript(10)
expected := "3.1415926535"
if result != expected {
t.Errorf("Expected %s, got %s", expected, result)
}
}
func Test5Decimals(t *testing.T) {
result := runScript(5)
expected := "3.14159"
if result != expected {
t.Errorf("Expected %s, got %s", expected, result)
}
}
func Test1Decimal(t *testing.T) {
result := runScript(1)
expected := "3.1"
if result != expected {
t.Errorf("Expected %s, got %s", expected, result)
}
}
func Test100Decimals(t *testing.T) {
result := runScript(100)
expected := "3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679"
if result != expected {
t.Errorf("Expected %s, got %s", expected, result)
}
}
func TestDefault100Decimals(t *testing.T) {
result := runScript()
expected := "3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679"
if result != expected {
t.Errorf("Expected %s, got %s", expected, result)
}
}
func Test10000Decimals(t *testing.T) {
result := runScript(10000)
// Check length: "3." + 10000 digits = 10002 characters
if len(result) != 10002 {
t.Errorf("Expected 10002 characters, got %d", len(result))
}
if !strings.HasPrefix(result, "3.14159") {
t.Errorf("Result should start with 3.14159, got %s", result[:10])
}
}
+109
View File
@@ -0,0 +1,109 @@
package main
import (
"fmt"
"math/big"
"os"
"strconv"
)
func main() {
// Hämta antal decimaler från argument
decimals := 100
if len(os.Args) > 1 {
if d, err := strconv.Atoi(os.Args[1]); err == nil && d > 0 {
decimals = d
}
}
// Beräkna pi med Machins formel: pi/4 = 4*arctan(1/5) - arctan(1/239)
// Använd exakt aritmetik med big.Int
pi := calculatePiExact(decimals)
// Skriv ut resultatet
fmt.Println(formatPiExact(pi, decimals))
}
func calculatePiExact(decimals int) *big.Int {
// pi = 4 * (4*arctan(1/5) - arctan(1/239))
// Skala med 10^(decimals+10) för exakt aritmetik
scale := new(big.Int).Exp(big.NewInt(10), big.NewInt(int64(decimals+10)), nil)
atan1_5 := arctanExact(5, scale)
atan1_239 := arctanExact(239, scale)
// 4 * atan(1/5)
result := new(big.Int).Mul(big.NewInt(4), atan1_5)
// - atan(1/239)
result.Sub(result, atan1_239)
// * 4
result.Mul(result, big.NewInt(4))
return result
}
func arctanExact(x int64, scale *big.Int) *big.Int {
// arctan(1/x) = 1/x - 1/(3*x^3) + 1/(5*x^5) - ...
// Med skala: scale/x - scale/(3*x^3) + scale/(5*x^5) - ...
result := big.NewInt(0)
xBig := big.NewInt(x)
xSquared := new(big.Int).Mul(xBig, xBig)
// term = scale / x
term := new(big.Int).Div(scale, xBig)
sign := big.NewInt(1)
for n := 0; n < 100000; n++ {
// Lägg till term / (2n+1) med rätt tecken
divisor := big.NewInt(int64(2*n + 1))
contrib := new(big.Int).Div(term, divisor)
if sign.Sign() > 0 {
result.Add(result, contrib)
} else {
result.Sub(result, contrib)
}
// Nästa term: term = term / x^2
term.Div(term, xSquared)
// Växla tecken
sign.Neg(sign)
// Avbryt om termen är 0
if term.Sign() == 0 {
break
}
}
return result
}
func formatPiExact(pi *big.Int, decimals int) string {
// Konvertera till sträng
piStr := pi.String()
// pi är skalad med 10^(decimals+10), så vi behöver justera decimalpunkten
// För pi ≈ 3.14159..., pi*10^110 ≈ 314159... (110 siffror)
// Lägg till ledande noll om nödvändigt
for len(piStr) < decimals+10 {
piStr = "0" + piStr
}
// Ta första siffran, sedan decimalpunkt, sedan resten
if len(piStr) > decimals+10 {
piStr = piStr[:decimals+10]
}
// Resultatet bör vara "3" följt av decimaler
result := string(piStr[0]) + "." + piStr[1:decimals+1]
return result
}
+126
View File
@@ -0,0 +1,126 @@
package main
import (
"math/big"
"os"
"os/exec"
"strings"
"testing"
)
func TestPi10Decimals(t *testing.T) {
cmd := exec.Command("./print_hej", "10")
output, err := cmd.Output()
if err != nil {
t.Fatalf("Kunde inte köra program: %v", err)
}
result := strings.TrimSpace(string(output))
expected := "3.1415926535"
if result != expected {
t.Errorf("Fel resultat för 10 decimaler.\nFörväntade: %s\nFick: %s", expected, result)
}
}
func TestPi5Decimals(t *testing.T) {
cmd := exec.Command("./print_hej", "5")
output, err := cmd.Output()
if err != nil {
t.Fatalf("Kunde inte köra program: %v", err)
}
result := strings.TrimSpace(string(output))
expected := "3.14159"
if result != expected {
t.Errorf("Fel resultat för 5 decimaler.\nFörväntade: %s\nFick: %s", expected, result)
}
}
func TestPi1Decimal(t *testing.T) {
cmd := exec.Command("./print_hej", "1")
output, err := cmd.Output()
if err != nil {
t.Fatalf("Kunde inte köra program: %v", err)
}
result := strings.TrimSpace(string(output))
expected := "3.1"
if result != expected {
t.Errorf("Fel resultat för 1 decimal.\nFörväntade: %s\nFick: %s", expected, result)
}
}
func TestPiDefault(t *testing.T) {
cmd := exec.Command("./print_hej")
output, err := cmd.Output()
if err != nil {
t.Fatalf("Kunde inte köra program: %v", err)
}
result := strings.TrimSpace(string(output))
// Läs facit
facit, err := os.ReadFile("../facit.txt")
if err != nil {
t.Fatalf("Kunde inte läsa facit: %v", err)
}
expected := strings.TrimSpace(string(facit))
expected = strings.ReplaceAll(expected, "\n", "")[:103]
if result != expected {
t.Errorf("Fel resultat för default (100 decimaler).\nFörväntade: %s\nFick: %s", expected, result)
}
}
func TestPiInvalidInput(t *testing.T) {
cmd := exec.Command("./print_hej", "abc")
output, err := cmd.Output()
if err != nil {
t.Fatalf("Kunde inte köra program: %v", err)
}
result := strings.TrimSpace(string(output))
// Ska använda default (100 decimaler)
if !strings.HasPrefix(result, "3.1415926535") {
t.Errorf("Hanterar inte ogiltig input korrekt.\nFick: %s", result)
}
}
func TestCalculatePiExact(t *testing.T) {
pi := calculatePiExact(10)
result := formatPiExact(pi, 10)
expected := "3.1415926535"
if result != expected {
t.Errorf("calculatePiExact gav fel resultat.\nFörväntade: %s\nFick: %s", expected, result)
}
}
func TestArctanExact(t *testing.T) {
scale := new(big.Int).Exp(big.NewInt(10), big.NewInt(20), nil)
// arctan(1/5) ska vara ungefär 0.1973955598...
atan1_5 := arctanExact(5, scale)
// Kontrollera att resultatet är positivt
if atan1_5.Sign() <= 0 {
t.Errorf("arctan(1/5) ska vara positivt, fick: %v", atan1_5)
}
}
func TestFormatPiExact(t *testing.T) {
// Skapa ett pi-värde: 31415926535... (skalat med 10^10)
pi := big.NewInt(31415926535)
result := formatPiExact(pi, 10)
expected := "3.1415926535"
if result != expected {
t.Errorf("formatPiExact gav fel resultat.\nFörväntade: %s\nFick: %s", expected, result)
}
}
+23
View File
@@ -0,0 +1,23 @@
#!/bin/bash
# Haskell Build Script
SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
cd "$SCRIPT_DIR"
echo "=== Haskell Build ==="
echo ""
# Kompilera Haskell-programmet
ghc -o bin/print_hej src/print_hej.hs
if [ $? -eq 0 ]; then
echo "✓ Kompilering lyckades!"
echo "Binär: bin/print_hej"
echo ""
echo "För att köra:"
echo " ./bin/print_hej [decimaler]"
else
echo "✗ Kompilering misslyckades!"
exit 1
fi
+19
View File
@@ -0,0 +1,19 @@
#!/bin/bash
# Haskell Unit Tests
SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
cd "$SCRIPT_DIR"
echo "=== Haskell Pi-beräkning Unit Tester ==="
echo ""
cd src
ghc -o ../bin/pi_test PiTest.hs
if [ $? -eq 0 ]; then
../bin/pi_test
exit $?
else
echo "✗ Kompilering av tester misslyckades!"
exit 1
fi
+66
View File
@@ -0,0 +1,66 @@
module Main where
import Test.HUnit
import System.Process
import Data.List (stripPrefix)
scriptPath :: String
scriptPath = "/Users/einand/Code/test/haskell/print_hej"
runScript :: Maybe String -> IO String
runScript mArgs = do
let args = maybe [] (\x -> [x]) mArgs
output <- readProcess scriptPath args ""
return $ init output -- Remove trailing newline
test10Decimals :: Test
test10Decimals = TestCase $ do
result <- runScript (Just "10")
let expected = "3.1415926535"
assertEqual "10 decimals" expected result
test5Decimals :: Test
test5Decimals = TestCase $ do
result <- runScript (Just "5")
let expected = "3.14159"
assertEqual "5 decimals" expected result
test1Decimal :: Test
test1Decimal = TestCase $ do
result <- runScript (Just "1")
let expected = "3.1"
assertEqual "1 decimal" expected result
test100Decimals :: Test
test100Decimals = TestCase $ do
result <- runScript (Just "100")
let expected = "3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679"
assertEqual "100 decimals" expected result
testDefault100Decimals :: Test
testDefault100Decimals = TestCase $ do
result <- runScript Nothing
let expected = "3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679"
assertEqual "default 100 decimals" expected result
test10000Decimals :: Test
test10000Decimals = TestCase $ do
result <- runScript (Just "10000")
-- Check length: "3." + 10000 digits = 10002 characters
assertEqual "10000 decimals length" 10002 (length result)
assertBool "10000 decimals starts with 3.14159" (take 7 result == "3.14159")
tests :: Test
tests = TestList [
TestLabel "test10Decimals" test10Decimals,
TestLabel "test5Decimals" test5Decimals,
TestLabel "test1Decimal" test1Decimal,
TestLabel "test100Decimals" test100Decimals,
TestLabel "testDefault100Decimals" testDefault100Decimals,
TestLabel "test10000Decimals" test10000Decimals
]
main :: IO ()
main = do
counts <- runTestTT tests
putStrLn $ showCounts counts
+49
View File
@@ -0,0 +1,49 @@
module Main where
import System.Environment (getArgs)
import Data.Char (digitToInt)
-- Calculate arctan(1/x) using Taylor series
-- arctan(1/x) = 1/x - 1/(3*x^3) + 1/(5*x^5) - ...
arctan :: Integer -> Integer -> Integer
arctan x decimals = arctanIter scale xSquared term 0 0
where
scale = 10 ^ (decimals + 10)
xSquared = x * x
term = scale `div` x -- First term: scale / x
arctanIter :: Integer -> Integer -> Integer -> Integer -> Integer -> Integer
arctanIter scale xSquared term n result
| term == 0 || n > decimals * 3 = result
| otherwise = arctanIter scale xSquared newTerm (n + 1) newResult
where
divisor = 2 * n + 1
contrib = term `div` divisor
newResult = if even n
then result + contrib
else result - contrib
newTerm = term `div` xSquared -- Divide by x² each iteration
-- Calculate pi using Machin's formula
-- pi/4 = 4*arctan(1/5) - arctan(1/239)
calculatePi :: Integer -> Integer
calculatePi decimals = 16 * atan1_5 - 4 * atan1_239
where
atan1_5 = arctan 5 decimals
atan1_239 = arctan 239 decimals
-- Format pi with decimal point
formatPi :: Integer -> Integer -> String
formatPi pi decimals = "3." ++ take (fromIntegral decimals) (drop 1 (show pi))
main :: IO ()
main = do
args <- getArgs
let decimals = case args of
[] -> 100
(x:_) -> case reads x :: [(Integer, String)] of
[(d, _)] -> if d > 0 then d else 100
_ -> 100
let pi = calculatePi decimals
putStrLn (formatPi pi decimals)
+35
View File
@@ -0,0 +1,35 @@
#!/bin/bash
# Java Build Script
SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
cd "$SCRIPT_DIR"
echo "=== Java Build ==="
echo ""
# Kompilera Java-programmet
cd src
javac print_hej.java
if [ $? -eq 0 ]; then
echo "✓ Kompilering lyckades!"
echo "Class: src/print_hej.class"
echo ""
echo "För att köra:"
echo " java -cp src print_hej [decimaler]"
# Skapa wrapper script
mkdir -p ../bin
cat > ../bin/print_hej << 'EOF'
#!/bin/bash
SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
cd "$SCRIPT_DIR"
java -cp src print_hej "$@"
EOF
chmod +x ../bin/print_hej
echo "Wrapper script skapad: bin/print_hej"
else
echo "✗ Kompilering misslyckades!"
exit 1
fi
+65
View File
@@ -0,0 +1,65 @@
import java.math.BigInteger;
public class print_hej {
public static void main(String[] args) {
int decimals = 100;
if (args.length > 0) {
try {
decimals = Integer.parseInt(args[0]);
if (decimals <= 0) decimals = 100;
} catch (NumberFormatException e) {
decimals = 100;
}
}
BigInteger pi = calculatePi(decimals);
System.out.println(formatPi(pi, decimals));
}
// Calculate arctan(1/x) using Taylor series
static BigInteger arctan(int x, int decimals) {
BigInteger scale = BigInteger.TEN.pow(decimals + 10);
BigInteger xBig = BigInteger.valueOf(x);
BigInteger xSquared = xBig.multiply(xBig);
BigInteger result = BigInteger.ZERO;
BigInteger term = scale.divide(xBig);
int n = 0;
while (term.compareTo(BigInteger.ZERO) != 0 && n < decimals * 3) {
BigInteger divisor = BigInteger.valueOf(2 * n + 1);
BigInteger contrib = term.divide(divisor);
if (n % 2 == 0) {
result = result.add(contrib);
} else {
result = result.subtract(contrib);
}
term = term.divide(xSquared);
n++;
if (n > decimals * 2) break;
}
return result;
}
// Calculate pi using Machin's formula
static BigInteger calculatePi(int decimals) {
BigInteger atan1_5 = arctan(5, decimals);
BigInteger atan1_239 = arctan(239, decimals);
return atan1_5.multiply(BigInteger.valueOf(16))
.subtract(atan1_239.multiply(BigInteger.valueOf(4)));
}
// Format pi with decimal point
static String formatPi(BigInteger pi, int decimals) {
String piStr = pi.toString();
while (piStr.length() < decimals + 10) {
piStr = "0" + piStr;
}
return "3." + piStr.substring(1, decimals + 1);
}
}
+28
View File
@@ -0,0 +1,28 @@
#!/bin/bash
# JavaScript Build Script - JavaScript är interpreterat, ingen kompilering behövs
SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
cd "$SCRIPT_DIR"
echo "=== JavaScript Build ==="
echo "JavaScript är ett interpreterat språk, ingen kompilering behövs."
echo "Script: src/print_hej.js"
echo ""
# Skapa wrapper script
mkdir -p bin
cat > bin/print_hej << 'EOF'
#!/bin/bash
SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
cd "$SCRIPT_DIR"
node src/print_hej.js "$@"
EOF
chmod +x bin/print_hej
echo "Wrapper script skapad: bin/print_hej"
echo ""
echo "För att köra:"
echo " ./bin/print_hej [decimaler]"
echo ""
echo "✓ Klart!"
+14
View File
@@ -0,0 +1,14 @@
#!/bin/bash
# JavaScript Unit Tests
SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
cd "$SCRIPT_DIR"
echo "=== JavaScript Pi-beräkning Unit Tester (Jest) ==="
echo ""
cd src
npm test
exit $?
+3678
View File
File diff suppressed because it is too large Load Diff
+14
View File
@@ -0,0 +1,14 @@
{
"name": "javascript-pi",
"version": "1.0.0",
"description": "JavaScript pi calculation",
"scripts": {
"test": "jest"
},
"dependencies": {
"big.js": "^7.0.1"
},
"devDependencies": {
"jest": "^29.0.0"
}
}
+29
View File
@@ -0,0 +1,29 @@
#!/bin/bash
# Julia Build Script
SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
cd "$SCRIPT_DIR"
echo "=== Julia Build ==="
echo ""
# Julia är ett interpreterat språk, men vi kan förkompilera för snabbare start
# Skapa wrapper script
mkdir -p bin
cat > bin/print_hej << 'EOF'
#!/bin/bash
SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
cd "$SCRIPT_DIR"
julia src/print_hej.jl "$@"
EOF
chmod +x bin/print_hej
echo "✓ Ingen kompilering behövs för Julia"
echo " Använder Julia interpreter"
echo ""
echo "Wrapper script skapad: bin/print_hej"
echo ""
echo "För att köra:"
echo " ./bin/print_hej [decimaler]"
+19
View File
@@ -0,0 +1,19 @@
#!/bin/bash
# Julia Test Script
SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
cd "$SCRIPT_DIR"
echo "=== Julia Test ==="
echo ""
# Testa pi-beräkning med olika antal decimaler
for decimals in 1 2 5 10 100; do
result=$(./bin/print_hej $decimals 2>/dev/null)
if [ $? -eq 0 ]; then
echo "$decimals decimaler: $result"
else
echo "$decimals decimaler misslyckades"
fi
done

Some files were not shown because too many files have changed in this diff Show More