Get the latest tech news
A real fixed-point decimal crate in Rust
Primitive fixed-point decimal types in Rust. Contribute to WuBingzheng/primitive_fixed_point_decimal development by creating an account on GitHub.
For example, in traditional currency exchange, you can use ConstScaleFpdec<i64, 2> to represent balance, e.g. 1234.56 USD and 8888800.00 JPY. In this crate, functions with the cum_error parameter provide control over cumulative error based on int-div-cum-error. For instance, the funds scale is 2 decimal places, one order quantity is 10.00 USD, and the fee rate is 0.003.
Or read this on Hacker News