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 new helper methods: BigInt, BigFloat #171

Merged
merged 4 commits into from
Apr 19, 2020
Merged

Add new helper methods: BigInt, BigFloat #171

merged 4 commits into from
Apr 19, 2020

Conversation

mwoss
Copy link
Member

@mwoss mwoss commented Apr 19, 2020

Those are requested by the community two new helper methods that would make it easier to use the library and prevent users from making an improper decimal casting.
In the tests, I used strings for compersion as it is easier to read them in that way and it does not change result of the tests.

@mwoss mwoss requested a review from njason April 19, 2020 17:31
Copy link
Member

@njason njason left a comment

Choose a reason for hiding this comment

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

Might be good to add some test cases that expect failure, like number being too big

@njason
Copy link
Member

njason commented Apr 19, 2020

Or loss of precision

@mwoss
Copy link
Member Author

mwoss commented Apr 19, 2020

Hm, I wasn't aware that big.Float is not available in Go v.1.2. What should we do? Drop support for that version or remove that new functionality? I'm not sure whether decimal should be still compatible with over 7 years old version fo Go.

@mwoss
Copy link
Member Author

mwoss commented Apr 19, 2020

@njason big.Float is available from Go version >1.5. I would say it's ok to remove support for such old Go versions and stick to the pattern of other open-source go libraries.
If we gonna see any complaints we could revert the new BigFloat helper method.

@njason
Copy link
Member

njason commented Apr 19, 2020

Sounds good to me

@mwoss mwoss merged commit 1884f45 into master Apr 19, 2020
@mwoss mwoss mentioned this pull request Apr 19, 2020
@mwoss mwoss deleted the big-part-methods branch April 20, 2020 21:27
fairyhunter13 added a commit to fairyhunter13/decimal that referenced this pull request Jul 12, 2020
* Add new helper methods: BigInt, BigFloat
* Add few tests cases showing loss of precision after casting
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.

2 participants