16 releases (8 stable)

Uses old Rust 2015

2.1.0 Mar 8, 2021
2.0.4 Dec 4, 2017
2.0.1 Nov 29, 2017
1.0.1 Jun 18, 2017
0.2.0 Dec 16, 2015

#941 in Math

Download history 551/week @ 2024-11-21 762/week @ 2024-11-28 629/week @ 2024-12-05 768/week @ 2024-12-12 537/week @ 2024-12-19 468/week @ 2024-12-26 737/week @ 2025-01-02 680/week @ 2025-01-09 739/week @ 2025-01-16 826/week @ 2025-01-23 769/week @ 2025-01-30 1322/week @ 2025-02-06 1065/week @ 2025-02-13 941/week @ 2025-02-20 737/week @ 2025-02-27 644/week @ 2025-03-06

3,594 downloads per month
Used in 17 crates (14 directly)

Apache-2.0

1MB
11K SLoC

C 10K SLoC // 0.4% comments Rust 1.5K SLoC // 0.0% comments

decimal

Travis Downloads Crates.io Apache license

Decimal Floating Point arithmetic for rust based on the decNumber library.

The library provides d128 which is a 128-bit decimal floating point number. You can use it as other primitive numbers in Rust. All operators are overloaded to allow ergonomic use of this type.

To emulate literals a macro is used d128!.

Documentation

Example

let x = d128!(1.234);
let y = d128!(1.111);
let z = d128!(2.345);
assert_eq(x + y, z);

Running the decTest test suite

$ cargo build
$ ./target/debug/run-test decTest/decQuad.decTest

Dependencies