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

Make epsilon for float comparison customizable - #3159 #3817

Conversation

SebastianKull
Copy link

it would be possible to make the epsilon from float comparison customizable.
see #3159

grafik

@@ -55,10 +55,15 @@ public function __construct($value)
*/
public function evaluate($other, string $description = '', bool $returnResult = false)
{
$epsilon = self::EPSILON;
if (defined('CUSTOM_EPSILON')) {
Copy link
Sponsor Contributor

Choose a reason for hiding this comment

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

What about defining EPSILON conditionally in a namespace, and always having it declared?

Basides that, while the global state is immutable, I'm not sure I like the approach. What alternatives (if any) do we have?

@SebastianKull SebastianKull force-pushed the feature/3159-isidentical-customizable-epsilon branch from dbc06cc to df1b398 Compare September 6, 2019 12:46
@sebastianbergmann
Copy link
Owner

Thank you for your contribution. I appreciate the time you invested in preparing this pull request. However, I have decided not to merge it. See https://github.com/sebastianbergmann/phpunit/issues/3159#issuecomment-528908608 for details.

@epdenouden epdenouden added the event/code-sprint/2019-09 PHPUnit Code Sprint: September 2019 label Sep 7, 2019
@SebastianKull SebastianKull deleted the feature/3159-isidentical-customizable-epsilon branch September 7, 2019 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
event/code-sprint/2019-09 PHPUnit Code Sprint: September 2019
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants