{"repo":"WuBingzheng/decimax","free":true,"listed":false,"github":"https://github.com/WuBingzheng/decimax","clone":"git clone https://github.com/WuBingzheng/decimax.git","description":"Fast, fixed-size, floating-point decimal types.","language":"Rust","stars":21,"topics":["decimal","mathematics","finance"],"license":null,"category":"trading","readme_excerpt":"Fast, fixed-size, floating-point decimal types. This crate represents decimals accurately by scaling integer in base-10. So there is no round-off error like 0.1 + 0.2 != 0.3. There are kinds of ways to represent decimals, each with its own focus. This crate is same kind to the most popular rust decimal , but better . Compare with rust decimal This crate has these advantages: - Much faster. This crate is 2X 6X faster than rust decimal at + , - and operations. While the / is complex, with both faster and slower cases. A typical comparison is shown in below chart. See the benchmark for details. - More significant digits and fraction digits. All bits of the underlying integer are used. No waste. For example the 128-bit signed decimal type [ Dec128 ] has 122 bits for mantissa (about 36 decimal significant digits), 5 bits for scale (at most 31 fraction digits), and 1 bit for sign. While rust decimal has 96 bits for mantissa (about 28 digits) and at most 28 fraction digits. - More types. It provides 6 types by now. Long and short (128/64/32-bit), signed and unsigned. How is it made faster? In fact, there is no black magic in this crate (except for a fast division algorithm which is used in just a few cases). I suspect the performance gain isn’t so much because this crate is fast, but because rust decimal is slow. In this crate, the decimal is defined as a single integer. Take the 128-bit type as example: The sign( S ), scale, and mantissa occupy 1, 5, and 122 bits respectively. The ","default_branch":null,"files":null,"tree":[],"storefront":"/r/WuBingzheng","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/WuBingzheng/decimax/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}