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

Comparison of a floats against 0 with potentially problematic "==" in function _res_part_extra` #334

Closed
dschlaep opened this issue Jul 8, 2019 · 1 comment
Assignees
Labels
bug in progress Task is currently in progress
Milestone

Comments

@dschlaep
Copy link
Member

dschlaep commented Jul 8, 2019

In function _res_part_extra:

The float variable sum_size is compared for equality against 0 with the == operand
--> this could have an impact in that these float comparisons could fail (even if they should not) and req_prob would be calculated as potentially really large in absolute value (division by almost ±zero value of sum_size)
--> https://stackoverflow.com/questions/4548004/how-to-correctly-and-standardly-compare-floats
--> suggested fix: replace condition in line 256 with ZRO(sum_size)

@dschlaep dschlaep added bug in progress Task is currently in progress labels Jul 8, 2019
@dschlaep dschlaep added this to the feature_space milestone Jul 8, 2019
@dschlaep dschlaep self-assigned this Jul 8, 2019
dschlaep added a commit that referenced this issue Jul 8, 2019
Use macro `ZRO` instead of `== 0` to check whether the float variable `sum_size` is zero

- close #334

- this commit does not change the testing output on my local computer (this condition is never triggered in the test run)
@dschlaep
Copy link
Member Author

dschlaep commented Jul 8, 2019

closed by e2c03a8

@dschlaep dschlaep closed this as completed Jul 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug in progress Task is currently in progress
Projects
None yet
Development

No branches or pull requests

1 participant