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

#910 in Math

Download history 455/week @ 2024-09-27 395/week @ 2024-10-04 427/week @ 2024-10-11 568/week @ 2024-10-18 534/week @ 2024-10-25 539/week @ 2024-11-01 359/week @ 2024-11-08 551/week @ 2024-11-15 565/week @ 2024-11-22 781/week @ 2024-11-29 635/week @ 2024-12-06 732/week @ 2024-12-13 523/week @ 2024-12-20 486/week @ 2024-12-27 727/week @ 2025-01-03 598/week @ 2025-01-10

2,395 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