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

#10 in #decimal

Download history 2724/week @ 2021-08-13 2411/week @ 2021-08-20 2611/week @ 2021-08-27 1316/week @ 2021-09-03 3272/week @ 2021-09-10 1959/week @ 2021-09-17 2703/week @ 2021-09-24 2108/week @ 2021-10-01 2822/week @ 2021-10-08 2699/week @ 2021-10-15 3740/week @ 2021-10-22 4340/week @ 2021-10-29 5636/week @ 2021-11-05 4116/week @ 2021-11-12 3970/week @ 2021-11-19 4851/week @ 2021-11-26

19,832 downloads per month
Used in 16 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