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

Faster way to convert decimal.Decimal to alpacadecimal.Decimal #7

Open
gyson opened this issue May 23, 2023 · 0 comments · May be fixed by #13
Open

Faster way to convert decimal.Decimal to alpacadecimal.Decimal #7

gyson opened this issue May 23, 2023 · 0 comments · May be fixed by #13

Comments

@gyson
Copy link
Contributor

gyson commented May 23, 2023

sometimes, we have external API that returns decimal.Decimal, and we need to convert these instances to alpacadecimal.Decimal.

currently, we can do this converson via "string" (decimal.Decimal -> string -> alpacadecimal.Decimal).

but there might be more efficient way to do this via: (decimal.Decimal -> decimal.Exponent() + decimal.Coefficient() / decimal.CoefficientInt64() -> alpacadecimal.NewFromBigInt

^ requires benchmarks

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