Got Rust working on **piCore (Raspberry Pi 400)** and successfully compiled a Chudnovsky‑based π calculator using the `rug` big‑number crate.
**Steps:**
- Install Rust and toolchain:
```
tce-load -wi rust compiletc binutils make ```
- Create project:
```
cargo new pi_calc ```
- Add to `Cargo.toml`:
```toml
[dependencies]
rug = "1.28"
```
**Simple Chudnovsky implementation (works on piCore):**
```rust
use rug::{Float};
use rug::ops::Pow;
fn main() {
let digits: u32 = 10000;
let prec: u32 = digits + 20;
let pi = compute_pi(prec);
println!("{}", pi.to_string_radix(10, Some((digits + 2) as usize)));
}
fn compute_pi(prec: u32) -> Float {
let mut sum = Float::with_val(prec, 0);
for k in 0..20 {
let f6k = factorial(6 * k);
let f3k = factorial(3 * k);
let fk = factorial(k);
let a = Float::with_val(prec, 13591409 + 545140134 * k as i32);
let b = Float::with_val(prec, 640320).pow(3 * k + 1);
let term = Float::with_val(prec, &f6k * a / (&f3k * fk.pow(3) * b));
if k % 2 == 0 { sum += term } else { sum -= term }
}
Float::with_val(prec, 1) / (Float::with_val(prec, 12) * sum)
}
fn factorial(n: u32) -> Float {
let mut f = Float::with_val(128, 1);
for i in 2..=n { f *= i }
f
}
```
Outputs π to 10k digits on a Pi 400 without issues.
[Edit]: Added code tags. Rich