| Crates.io | big_number |
| lib.rs | big_number |
| version | 0.2.0 |
| created_at | 2025-05-26 10:55:22.323386+00 |
| updated_at | 2025-05-26 16:54:06.716479+00 |
| description | A scientific notation number type for idle/incremental games. |
| homepage | https://github.com/sh4ka/big_number |
| repository | https://github.com/sh4ka/big_number |
| max_upload_size | |
| id | 1689356 |
| size | 12,047 |
A scientific notation number type for idle/incremental games in Rust.
big_number is a lightweight library that provides a simple implementation of big numbers using scientific notation, specifically designed for incremental/idle games where extremely large numbers are common.
The library represents numbers in the form mantissa * 10^exponent where the mantissa is normalized to be between 1.0 and 10.0 (except for zero).
Add this to your Cargo.toml:
[dependencies]
big_number = "0.2.0"
use big_number::BigNumber;
// Create big numbers
let a = BigNumber::new(2.5, 10); // 2.5e10
let b = BigNumber::new(3.0, 5); // 3.0e5
// Basic operations
let sum = a.add(b); // Addition
let difference = a.sub(b); // Subtraction
let product = a.mul(b); // Multiplication
let quotient = a.div(b); // Division
// Convert to string
println!("a = {}", a.to_string()); // "2.500e10"
println!("a + b = {}", sum.to_string()); // Result of addition
// Helper methods
let zero = BigNumber::zero();
let one = BigNumber::one();
Licensed under either of:
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you shall be dual licensed as above, without any additional terms or conditions.