mpdec

Crates.iompdec
lib.rsmpdec
version4.0.1
created_at2025-06-27 01:54:21.084952+00
updated_at2025-06-27 01:54:21.084952+00
descriptionwrapper for libmpdec math library
homepage
repositoryhttps://gitlab.com/omnid/rust-crates/mpdec
max_upload_size
id1728059
size54,305
(srtnnm)

documentation

README

mpdec

Rust wrapper around libmpdec — a high-performance C library for arbitrary-precision decimal floating point arithmetic.

Built on top of raw FFI bindings (mpdec-sys), this crate provides idiomatic Rust types and operations for working with decimal numbers with precise rounding behavior and conformance to the General Decimal Arithmetic Specification.

Example

use std::str::FromStr;
use mpdec::Decimal;

fn main() {
    let a = Decimal::from_str("1.2345").unwrap();
    let b = Decimal::from_str("2.0000").unwrap();
    let c = a * b;
    println!("Result: {}", c);  // Result: 2.4690
}
Commit count: 0

cargo fmt