Hyperoperation
This crate allows to calculate and format hyperoperation, sometimes known as Knuth's up-arrow notation, which is a way to define very large numbers, such as famous 3↑↑↑3.
Features
- Calculate value of hyperoperations (more and more)
- Format hyperoperations with Knuth's up-arrow notation (more)
- Use any unsigned numeric type for calculation fitting some conditions, such as BigUint
Examples
Simple calculation:
```rust
use hyperoperation::hyperoperation;
assert_eq!(
hyperoperation::(&3, 3, 2), // 3 ↑↑ 3
7625597484987
);
```
Using BigUint to handle big results without overflowing:
```rust
use num_bigint::BigUint;
use hyperoperation::hyperoperation;
let result = hyperoperation::(&5u8.into(), 3u8.into(), 2); // 5 ↑↑ 3
println!("Result:\n{result}");
asserteq!(
result % BigUint::from(100000_000u32),
8203125u32.into()
);
```
Using Hyperoperation struct and formatting it with Knuth's up-arrow notation:
```rust
use hyperoperation::Hyperoperation;
let expr = Hyperoperation::::new(3, 3, 2); // Represents 3 ↑↑ 3
let result = expr.clone().evaluate(); // Calculate the value of 3 ↑↑ 3
println!("{expr} = {result}");
asserteq!(result, 7625597484987);
asserteq!(format!("{expr}"), "3 ↑↑ 3");
```