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

bccomp with scale parameter #2

Merged
merged 2 commits into from
Jul 2, 2015

Conversation

xeviplana
Copy link
Contributor

Hi,

I think it makes no sense that all the operations are made with the SCALE parameter, and then when these numbers are compared it is done without the same SCALE. This leads to invalid results, since the numbers are compared ignoring their decimal part.

According to the official PHP documentation (http://php.net/manual/en/function.bccomp.php):

scale
The optional scale parameter is used to set the number of digits after the decimal place which will be used in the comparison.

With this fix, bccomp will know that for instance 1.22 is greater than 1.11.

@acasademont
Copy link
Contributor

@xeviplana you're totally right, thanks for the contribution! Are you using this library?

acasademont added a commit that referenced this pull request Jul 2, 2015
@acasademont acasademont merged commit 5d05a8c into ulabox:master Jul 2, 2015
@xeviplana
Copy link
Contributor Author

No problem, thank you for accepting the PR :)

Yes, we're using it! It's the simplest I could find and it solves our problems quite well. Keep the good work!

@xeviplana xeviplana deleted the compare_with_scale branch July 2, 2015 15:52
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