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

#61 in Finance

Download history 14497/week @ 2022-11-29 9812/week @ 2022-12-06 7657/week @ 2022-12-13 3833/week @ 2022-12-20 744/week @ 2022-12-27 7945/week @ 2023-01-03 6994/week @ 2023-01-10 8383/week @ 2023-01-17 9246/week @ 2023-01-24 10468/week @ 2023-01-31 12400/week @ 2023-02-07 14025/week @ 2023-02-14 17107/week @ 2023-02-21 17022/week @ 2023-02-28 25882/week @ 2023-03-07 18641/week @ 2023-03-14

79,097 downloads per month
Used in 17 crates (15 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