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.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of point

point

Photo of Rust

Rust

Photo of decimal crate

decimal crate

Related news:

News photo

Show HN: A DOS-like hobby OS written in Rust and x86 assembly

News photo

Show HN: Lstr – A modern, interactive tree command written in Rust

News photo

Bzip2 crate switches from C to 100% Rust