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

Use epsilon to compare floating points #194

Merged
merged 3 commits into from
Apr 3, 2023
Merged

Use epsilon to compare floating points #194

merged 3 commits into from
Apr 3, 2023

Conversation

bizurkur
Copy link
Contributor

@bizurkur bizurkur commented Apr 3, 2023

This is a alternative to #171 that doesn't require everyone to install bcmath to keep using this library.

Precision of 8 should be "close enough" to consider it equal. That's one 10 millionth of a fraction off... which is an incredibly small amount. 1 / 3 = 0.33333333 therefore 1 / 0.33333333 = 3 because it is "close enough."

Issue #172

- 1 / 3 = 0.33333333
- Therefore 1 / 0.33333333 = 3 because it is "close enough"
Copy link
Member

@scaytrase scaytrase left a comment

Choose a reason for hiding this comment

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

One small change suggested, but looks great!

tests/Schema/Keywords/MultipleOfTest.php Outdated Show resolved Hide resolved
@scaytrase scaytrase merged commit bccdd3f into thephpleague:master Apr 3, 2023
@scaytrase
Copy link
Member

Thanks @bizurkur ! Great catch

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