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

[8.x] Make multiple_of validation rule handle non-integer values #34971

Merged
merged 3 commits into from
Oct 26, 2020

Conversation

tontonsb
Copy link
Contributor

Currently multiple_of does not validate some of the cases where the input is an integer multiple of the step because fmod does not produce a zero on some of the cases, e.g. fmod(2, .1) = .1 and fmod(.9, .3) = some really small but non zero value.

This addes the tests for those cases and solves the issue by using bcmod and checking the first 16 digits after the decimal point.

Linked: discussion in #34960 and initial PR #34959 which I set to branch that I didn't intend to.

@driesvints driesvints changed the title Make multiple_of validation rule handle non-integer values [8.x] Make multiple_of validation rule handle non-integer values Oct 26, 2020
@taylorotwell taylorotwell merged commit c5ab5f7 into laravel:8.x Oct 26, 2020
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