Registry / utility / rust-decimal

rust-decimal

JSON →
library1.42.1rscratesunverified

Decimal number implementation written in pure Rust suitable for financial and fixed-precision calculations.

# Cargo.toml [dependencies] rust_decimal = "1.42.1"
INSTALL
IMPORT
SIG · RUST-DECIMAL
R
rust-decimal
utilityrustv1.42.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Decimal
use rust_decimal::Decimal;

Create and multiply Decimal values for financial calculations.

use rust_decimal::Decimal; use std::str::FromStr; fn main() { let price = Decimal::from_str("19.99").unwrap(); let quantity = Decimal::new(3, 0); let total = price * quantity; println!("Total: {}", total); }
Debug
Known issues
gotchaDefault precision is 28 digits; operations may panic on overflow if not using checked methods.
fix
Use checked arithmetic methods like `checked_add` or enable the `maths` feature for additional safety.
affects: >=0.1.0
Upgrade
Version history
1.42.1latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
3 hits · last 30 days
node
2
Amazon
1
Resources
rust-decimal — cargo add rust-decimal · libregistry