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

gmp: fix multiplier with leading zero #287

Merged
merged 1 commit into from
Oct 6, 2016
Merged

Conversation

frederikbosch
Copy link
Member

@frederikbosch frederikbosch commented Oct 6, 2016

Fixes #286

@sagikazarmark
Copy link
Collaborator

So is it actually something which can be fixed? Not a limitation of GMP, like in the referenced issue?

@frederikbosch
Copy link
Member Author

@sagikazarmark In the case of issue #278, there was an example that could never be the case inside Money. Why would you want to compare non-integers? That is simply impossible with Money because Money requires the amount to be integer. We never compare non-integers.

But issue #286 is different. One should be able to multiply an amount with decimal leading zero value. As you can see in the multiply method I created a workaround the limitation of GMP.

My point with the calculators is: they are Money internals. Anything inside the calculators that causes bugs inside Money should be fixed. Every other case should be ignored.

@frederikbosch frederikbosch merged commit 4cd4e5c into master Oct 6, 2016
@frederikbosch
Copy link
Member Author

@sagikazarmark Decimals within Money are only relevant when multiplying or with divisions. That is why I only created the workaround inside the GMP calculator for multiply and divide. Decimals are irrelevant when adding, subtracting and comparing because Money will always require integers for those methods.

@frederikbosch frederikbosch deleted the gmp-multiply branch October 6, 2016 08:43
@sagikazarmark
Copy link
Collaborator

@frederikbosch okay, agreed.

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