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

[BUG] expect_columns_equivalent handles infinity incorrectly. #5731

Closed
cwharris opened this issue Jul 20, 2020 · 3 comments · Fixed by #7410
Closed

[BUG] expect_columns_equivalent handles infinity incorrectly. #5731

cwharris opened this issue Jul 20, 2020 · 3 comments · Fixed by #7410
Assignees
Labels
bug Something isn't working libcudf Affects libcudf (C++/CUDA) code.

Comments

@cwharris
Copy link
Contributor

Describe the bug
When comparing any floating point value with (+/-) infinity, expect_columns_equivalent indicates the values are equivalent.

Steps/Code to reproduce bug

auto inf = std::numeric_limits<double>::infinity();
auto a = fixed_width_column_wrapper<double>({inf, inf, inf, inf});
auto b = fixed_width_column_wrapper<double>({0, 1, -1, -inf});
expect_columns_equivalent(a, b); // passes

Expected behavior
Any of these should fail:

auto inf = std::numeric_limits<double>::infinity();
auto inf_col =   cudf::test::fixed_width_column_wrapper<double>({inf});
expect_columns_equivalent(inf_col, fixed_width_column_wrapper<double>({0}));
expect_columns_equivalent(inf_col, fixed_width_column_wrapper<double>({1}));
expect_columns_equivalent(inf_col, fixed_width_column_wrapper<double>({-1}));
expect_columns_equivalent(inf_col, fixed_width_column_wrapper<double>({-inf}));

All of these should pass:

auto inf = std::numeric_limits<double>::infinity();
auto inf_col =   cudf::test::fixed_width_column_wrapper<double>({inf});
auto neg_inf_col =   cudf::test::fixed_width_column_wrapper<double>({-inf});
expect_columns_equivalent(inf_col, fixed_width_column_wrapper<double>({inf}));
expect_columns_equivalent(neg_inf_col, fixed_width_column_wrapper<double>({-inf}));

Additional Context
expect_columns_equal behaves as expected.

@cwharris cwharris added bug Something isn't working Needs Triage Need team to review and classify labels Jul 20, 2020
@kkraus14 kkraus14 added libcudf Affects libcudf (C++/CUDA) code. and removed Needs Triage Need team to review and classify labels Aug 5, 2020
@github-actions
Copy link

This issue has been labeled inactive-90d due to no recent activity in the past 90 days. Please close this issue if no further response or action is needed. Otherwise, please respond with a comment indicating any updates or changes to the original issue and/or confirm this issue still needs to be addressed.

@jrhemstad
Copy link
Contributor

I think @ttnghia fixed that already here: #7410

@ttnghia
Copy link
Contributor

ttnghia commented Feb 19, 2021

Yeah, I just tested the examples above. All passed with my fix. This can be closed when #7410 is merged.

@rapids-bot rapids-bot bot closed this as completed in #7410 Mar 2, 2021
rapids-bot bot pushed a commit that referenced this issue Mar 2, 2021
This PR fixes #5225 and fixes #5731 along with several improvements. In particular:

  * Fixes the function `stod` in `convert_floats.cu`, which incorrectly uses `max_mantissa`, thus produces incorrect results as mentioned in the issue #5225. Note that this PR still cannot produce perfectly matched results with `std::atof`, since handling float values near `inf` is very difficult.
  * Fixes the class `corresponding_rows_not_equivalent` which didn't handle `inf` and `nan`, thus it returned "equivalent" when comparing a valid float number with `inf`.
  * Adds a test case for those fixes.
  * Rewrite test cases for string=>float coversion to use `std::atof` results for comparison.

Authors:
  - Nghia Truong (@ttnghia)

Approvers:
  - Keith Kraus (@kkraus14)
  - Robert (Bobby) Evans (@revans2)
  - David (@davidwendt)
  - Vukasin Milovanovic (@vuule)

URL: #7410
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working libcudf Affects libcudf (C++/CUDA) code.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants