decimal icon indicating copy to clipboard operation
decimal copied to clipboard

Add NewFromBigRat function

Open davseby opened this issue 2 years ago • 1 comments

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.

davseby avatar Jun 21 '22 18:06 davseby

Hi, @mwoss @njason, could you guys please take a look? Thanks.

davseby avatar Aug 02 '22 17:08 davseby

well,I also encountered this problem today. Do you have any other way to solve it? @davseby

Cameron-Wang avatar Jun 21 '23 14:06 Cameron-Wang

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).

davseby avatar Jun 21 '23 15:06 davseby