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
Comparison with fixed epsilon in constant float type is wrong #9228
Labels
Comments
@mvorisek After the latest push in 1.11.x, PHPStan now reports different result with your code snippet: @@ @@
-36: Dumped type: 0.00012345678912346
-37: Dumped type: 0.00012345678912346
-38: Dumped type: 0.00012345678912346
-41: Parameter #1 $v of method Foo::acceptX() expects 0.00012345678912346, 0.00012345678912346 given.
-42: Parameter #1 $v of method Foo::acceptY() expects 0.00012345678912346, 0.00012345678912346 given.
-43: Parameter #1 $v of method Foo::acceptX() expects 0.00012345678912346, 0.00012345678912346 given.
+36: Dumped type: 0.000123456789123456
+37: Dumped type: 0.000123456789123457
+38: Dumped type: 0.000123456789123456|0.000123456789123457
+41: Parameter #1 $v of method Foo::acceptX() expects 0.000123456789123456, 0.000123456789123457 given.
+42: Parameter #1 $v of method Foo::acceptY() expects 0.000123456789123457, 0.000123456789123456 given.
+43: Parameter #1 $v of method Foo::acceptX() expects 0.000123456789123456, 0.000123456789123456|0.000123456789123457 given.
+44: Parameter #1 $v of method Foo::acceptY() expects 0.000123456789123457, 0.000123456789123456|0.000123456789123457 given. Full report
|
I'd welcome a regression test, but otherwise this is done. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Bug report
0.000123456789123456
type is not the same as0.000123456789123457
.Float precision fixed in phpstan/phpstan-src#2358.
Related fixes in phpunit:
PHP_FLOAT_EPSILON
sebastianbergmann/phpunit#4972Code snippet that reproduces the problem
https://phpstan.org/r/d5c58c0a-234f-4d01-b768-210a2ef98eb7
Expected output
described in repro
The text was updated successfully, but these errors were encountered: