From ebb03312c64f852f9e6a3a4ec25efa55bf1c7aad Mon Sep 17 00:00:00 2001 From: Eric Lynema Date: Mon, 1 Sep 2025 20:05:23 -0400 Subject: [PATCH] docs: Add README.md --- README.md | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..bd8a499 --- /dev/null +++ b/README.md @@ -0,0 +1,47 @@ +# Pi Calculator + +This is a multi-threaded Rust program that calculates the first n digits of Pi using the Bailey–Borwein–Plouffe (BBP) formula. It uses arbitrary-precision arithmetic to ensure the accuracy of the calculated digits. + +## Features + +* Calculates the first n digits of Pi. +* Multi-threaded to speed up the calculation. +* Configurable number of threads. +* Uses the BBP algorithm. +* High-precision calculation using the `rug` crate. + +## Building + +To build the program, you need to have Rust and Cargo installed. You can install them from [https://rustup.rs/](https://rustup.rs/). + +Once you have Rust and Cargo installed, you can build the program with the following command: + +```bash +cargo build --release +``` + +## Usage + +To run the program, you can use the following command: + +```bash +./target/release/pi [OPTIONS] +``` + +### Arguments + +* ``: The number of digits of Pi to calculate. + +### Options + +* `-t`, `--threads `: The number of threads to use. Defaults to 4. +* `-h`, `--help`: Print help information. +* `-V`, `--version`: Print version information. + +### Example + +To calculate the first 1000 digits of Pi using 8 threads, you can run the following command: + +```bash +./target/release/pi 1000 -t 8 +```