mpdec 4.0.1

wrapper for libmpdec math library
Documentation
  • Coverage
  • 4.35%
    1 out of 23 items documented1 out of 6 items with examples
  • Size
  • Source code size: 54.3 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 913.22 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 9s Average build duration of successful builds.
  • all releases: 9s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • srtnnm

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
}