Comparison and Benchmarking of Rust Decimal Crates A developer benchmarks Rust decimal crates, comparing fixed-point vs floating-point and fixed-precision vs arbitrary-precision designs for financial applications requiring exact decimal representation. My English is not very good, so this article was translated with the help of AI. Here is the Chinese version . As is well known, because 2 and 10 do not share the same prime factors, binary fractions cannot represent decimal fractions exactly. For example, f64 has the classic arithmetic error: 0.1 + 0.2 = 0.3 . Some application scenarios, such as finance, require exact representation of decimal fractions. This is why decimal crates are needed. Their use integers to represent the mantissa, along with a scale representing the number of decimal places. For example, the value 1.23 can be represented using integer 123 with scale = 2 . There are many decimal crates in the Rust ecosystem, each with different designs and trade-offs. Their differences mainly fall into two dimensions: Whether the scale is fixed or variable. This corresponds to Fixed-point https://en.wikipedia.org/wiki/Fixed-point arithmetic vs Floating-point https://en.wikipedia.org/wiki/Floating-point arithmetic . Whether the count of integers is fixed or arbitrary. This corresponds to Fixed-precision https://en.wikipedia.org/wiki/Fixed-precision arithmetic vs Arbitrary-precision https://en.wikipedia.org/wiki/Arbitrary-precision arithmetic . This article chooses several crates for comparison and benchmarking. Table of contents: The first two sections Fixed-point and Floating-point fixed-point-and-floating-point , Fixed-size and Arbitrary-precision fixed-size-and-arbitrary-precision introduce the characteristics of these categories. There is nothing particularly new here, so experienced readers may skip them. The next section Choosing Crates choosing-crates introduces several decimal crates. The final section Benchmark Comparison benchmark-comparison is the main focus of this article, benchmarking and comparing these crates. Fixed-point vs In fixed-point arithmetic, the scale is fixed and bound to the type. In floating-point arithmetic, the scale is variable and stored in each instance. Let’s illustrate this with code. A typical fixed-point type definition might look like this: js struct FixedPoint