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

Drop wrong float comparison with filter_var() #2656

Merged
merged 1 commit into from
Sep 26, 2024

Conversation

mvorisek
Copy link
Contributor

@mvorisek mvorisek commented Sep 30, 2023

discussion #2358 (comment)

... < PHP_FLOAT_EPSILON condition for small numbers always wrongly returned true, === is the only valid cmp as long as both left/right side of the operator are of type float

@mvorisek mvorisek changed the title Drop wrong comparison using PHP_FLOAT_EPSILON Drop wrong float comparison using PHP_FLOAT_EPSILON Sep 30, 2023
@mvorisek mvorisek marked this pull request as ready for review September 30, 2023 12:45
@phpstan-bot
Copy link
Collaborator

This pull request has been marked as ready for review.

@ondrejmirtes
Copy link
Member

These changes need tests to see what they’re sctually fixing.

@mvorisek mvorisek marked this pull request as draft September 23, 2024 06:46
@mvorisek mvorisek changed the base branch from 1.10.x to 1.12.x September 23, 2024 07:12
@mvorisek mvorisek changed the title Drop wrong float comparison using PHP_FLOAT_EPSILON Drop wrong float comparison for filter_var() Sep 23, 2024
@mvorisek mvorisek marked this pull request as ready for review September 23, 2024 07:30
@mvorisek mvorisek changed the title Drop wrong float comparison for filter_var() Drop wrong float comparison with filter_var() Sep 23, 2024
@phpstan-bot
Copy link
Collaborator

This pull request has been marked as ready for review.

@staabm
Copy link
Contributor

staabm commented Sep 23, 2024

TIL that '1e-50' is a numeric string. I guess its super rare, but we might have some logic in the codebase which does not allow - in numeric strings.

@ondrejmirtes ondrejmirtes merged commit fd304ca into phpstan:1.12.x Sep 26, 2024
483 of 500 checks passed
@ondrejmirtes
Copy link
Member

Thank you.

@mvorisek mvorisek deleted the no_epsilon_float_cmp branch September 26, 2024 10:21
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.

4 participants