While compiling the Eigen library provided by Open3D (https://github.com/IntelVCL/Open3D), I got the following compiler warnings xx/Open3d/src/External/Eigen/Eigen/src/Core/arch/CUDA/Half.h:241:19: warning: comparing floating point with == or != is unsafe [-Wfloat-equal] return float(a) == float(b); ~~~~~~~~ ^ ~~~~~~~~ xx/Open3d/src/External/Eigen/Eigen/src/Core/arch/CUDA/Half.h:244:19: warning: comparing floating point with == or != is unsafe [-Wfloat-equal] return float(a) != float(b); ~~~~~~~~ ^ ~~~~~~~~ 2 warnings generated. The problem exists also for the current master branch of Eigen. See the issue on GitHub: https://github.com/IntelVCL/Open3D/issues/154
At that point making an (un-)equal comparison is the only meaningful thing to do. We could globally or locally disable the warning. If we want to disable it locally, we should probably factor out the equal comparison to some method, so we don't add to much #pragma noise into the code.
There are some other points (mostly fall-back implementations), where we do equal-comparisons to Scalar(1) or Scalar(0), which in fact also generate said warning. (If you compile in C++03 mode with -Wfloat-equal using g++)
Actually we might want that a warning is still generated if operator==(half,half) is really called, but I cannot see how to do this: I tried to delay the instantiation of operator== by making it template, but because of the explicit conversions to float, the code after the conversions to float is checked whatsoever. https://bitbucket.org/eigen/eigen/commits/b797fa480f14
-- GitLab Migration Automatic Message -- This bug has been migrated to gitlab.com's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.com/libeigen/eigen/issues/1520.