rusty_money
rusty_money copied to clipboard
Decimal arithmetic specializations
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
.