#decimal #decNumber

bin+lib decimal

Decimal floating point arithmetic for Rust

15 releases (7 stable)

2.0.4 Dec 4, 2017
2.0.1 Nov 29, 2017
2.0.0 Sep 27, 2017
1.0.1 Jun 18, 2017
0.2.0 Dec 16, 2015

#6 in #decimal

Download history 534/week @ 2019-12-14 460/week @ 2019-12-21 672/week @ 2019-12-28 683/week @ 2020-01-04 923/week @ 2020-01-11 1228/week @ 2020-01-18 1198/week @ 2020-01-25 693/week @ 2020-02-01 804/week @ 2020-02-08 801/week @ 2020-02-15 493/week @ 2020-02-22 875/week @ 2020-02-29 799/week @ 2020-03-07 793/week @ 2020-03-14 872/week @ 2020-03-21 707/week @ 2020-03-28

3,321 downloads per month
Used in 13 crates (9 directly)

Apache-2.0

1MB
11K SLoC

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

decimal

Build Status Latest Version

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!.

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