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

Add NewFromBigRat function #288

Merged
merged 3 commits into from Feb 19, 2024
Merged

Add NewFromBigRat function #288

merged 3 commits into from Feb 19, 2024

Conversation

davseby
Copy link
Contributor

@davseby davseby commented Jun 21, 2022

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
Copy link
Contributor Author

davseby commented Aug 2, 2022

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

@Cameron-Wang
Copy link

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

@davseby
Copy link
Contributor Author

davseby commented Jun 21, 2023

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

Copy link
Member

@mwoss mwoss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look good to me :3 Thanks for the contribution!
I deeply apologize for the late review too :<

decimal.go Outdated Show resolved Hide resolved
@davseby davseby requested a review from mwoss February 18, 2024 12:58
@mwoss mwoss merged commit d00399e into shopspring:master Feb 19, 2024
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.

None yet

3 participants