Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Rust
  3. fastnum

fastnum

MITRustv0.7.5

Fixed-size decimal numbers implemented in pure Rust for exact-precision financial and crypto calculations.

Visit WebsiteGitHubGitHub
256 stars19 forks0 contributors

What is fastnum?

fastnum is a Rust library that implements fixed-size decimal numbers with exact precision, designed for financial, cryptocurrency, and other applications requiring accurate fixed-point calculations without rounding errors. It provides high-performance arithmetic operations, support for special values like NaN and Infinity, and avoids dynamic allocation by using fixed-size integer storage.

Target Audience

Rust developers working on financial systems, cryptocurrency applications, trading platforms, or any domain requiring exact decimal precision and high-performance numeric computations.

Value Proposition

Developers choose fastnum for its combination of exact precision, high performance (comparable to native types), fixed-size stack allocation, and comprehensive feature set including const evaluation, no_std support, and optional integrations with popular crates like serde and rand.

Overview

Fixed-size decimal numbers implemented in pure Rust

Use Cases

Best For

  • Financial calculations requiring exact decimal precision (e.g., currency conversions)
  • Cryptocurrency applications handling BTC, ETH, or other tokens with specific decimal places
  • High-performance trading systems where allocation overhead must be minimized
  • Embedded or no_std environments needing decimal arithmetic
  • WebAssembly projects requiring exact-precision numeric computations
  • Compile-time constant evaluation of decimal numbers

Not Ideal For

  • Applications requiring runtime-adjustable precision for numbers exceeding fixed integer size limits
  • Systems deeply integrated with arbitrary-precision decimal libraries like BigDecimal for interoperability
  • Performance-critical real-time simulations where native floating-point speed outweighs exact precision needs

Pros & Cons

Pros

Exact Decimal Precision

Eliminates rounding errors such as 0.1 + 0.2 = 0.3, which is critical for financial and crypto applications as emphasized in the README's overview.

Stack-Allocated Efficiency

Uses fixed-size integers to avoid dynamic allocation, making types trivially copyable and improving cache-friendliness, demonstrated in allocation benchmarks where it outperforms bigdecimal.

IEEE 754 Special Values

Supports ±0, ±Infinity, and NaN with standard semantics, enabling robust error handling in mathematical operations as listed in the features.

Const Evaluation Capabilities

Most methods are const, allowing compile-time parsing and calculations, enhancing performance and safety for known values, as highlighted in the 'Why fastnum?' section.

Cons

Pre-1.0 API Instability

The library is pre-1.0.0, so breaking changes in the public API are possible, as warned in the documentation, which could disrupt long-term projects.

Fixed Precision Constraint

Precision is arbitrary but fixed at compile-time and cannot be adjusted dynamically, limiting flexibility compared to arbitrary-precision alternatives like BigDecimal.

Performance Overhead

Benchmarks show operations like division are significantly slower than native f64, which might impact latency-sensitive applications such as high-frequency trading.

Frequently Asked Questions

Quick Stats

Stars256
Forks19
Contributors0
Open Issues13
Last commit1 month ago
CreatedSince 2024

Tags

#fixed-point#financial-computing#cryptocurrency#decimal-numbers#wasm#numerical-computing#rust#no-std#performance

Built With

R
Rust

Links & Resources

Website

Included in

Rust56.6k
Auto-fetched 16 hours ago

Related Projects

nalgebranalgebra

Linear algebra library for Rust.

Stars4,765
Forks558
Last commit24 days ago
faer-rsfaer-rs

Linear algebra foundation for the Rust programming language

Stars2,564
Forks101
Last commit1 month ago
emuemu

The write-once-run-anywhere GPGPU library for Rust

Stars1,604
Forks52
Last commit3 years ago
argminargmin

Numerical optimization in pure Rust

Stars1,269
Forks115
Last commit8 months ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub