Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decimal arithmetic specializations #106

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

obaltzer
Copy link

@obaltzer obaltzer commented Mar 1, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant