decimal
decimal copied to clipboard
Add NewFromBigRat function
This adds a convenience helper function that converts a big.Rat
to a Decimal
. Since it is impossible to guarantee an exact accuracy, a precision attribute is used.
Just as the Div
method has a DivRounded
method counterpart, perhaps this convenience function should have one as well? It could use the DivisionPrecision
variable and wouldn't accept a precision parameter.
Hi, @mwoss @njason, could you guys please take a look? Thanks.
well,I also encountered this problem today. Do you have any other way to solve it? @davseby
well,I also encountered this problem today. Do you have any other way to solve it? @davseby
Hi, since this package seems to be no longer maintained, we've decided to fork it: https://github.com/advbet/xdecimal
It is not fully backwards compatible (differences are mentioned in the README).