big_number 0.1.2

A scientific notation number type for idle/incremental games.
Documentation
  • Coverage
  • 14.29%
    2 out of 14 items documented0 out of 10 items with examples
  • Size
  • Source code size: 9.58 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.42 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 10s Average build duration of successful builds.
  • all releases: 11s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • sh4ka

Big Number

A scientific notation number type for idle/incremental games in Rust.

Crates.io

Overview

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).

Installation

Add this to your Cargo.toml:

[dependencies]
big_number = "0.1.0"

Usage

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();

Features

  • Simple and lightweight implementation
  • Basic arithmetic operations: addition, subtraction, multiplication, division
  • Automatic normalization of scientific notation
  • String representation for display
  • Optimized for performance in idle/incremental game scenarios

License

Licensed under either of:

at your option.

Contribution

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.