alpacadecimal icon indicating copy to clipboard operation
alpacadecimal copied to clipboard

Faster way to convert decimal.Decimal to alpacadecimal.Decimal

Open gyson opened this issue 1 year ago • 0 comments

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

gyson avatar May 23 '23 13:05 gyson