rusty_money icon indicating copy to clipboard operation
rusty_money copied to clipboard

Decimal arithmetic specializations

Open obaltzer opened this issue 11 months ago • 0 comments

The conversion to and from string for arithmetic operations between Money and Decimal are unnecessary and expensive:

test money::tests::bench_decimal_direct      ... bench:           3 ns/iter (+/- 0)
test money::tests::bench_decimal_from_string ... bench:          34 ns/iter (+/- 0)

I am proposing to implement the specializations for Decimal directly.

This PR also removes invalid arithmetic operations such as scalar divided by Money as we don't have reciprocal currency and adds Money / Money = Decimal.

obaltzer avatar Mar 01 '24 11:03 obaltzer