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

Migrate from boost::math::isnan to std::isnan #2819

Merged

Conversation

SunBlack
Copy link
Contributor

@SunBlack SunBlack commented Feb 1, 2019

There is a single boost::math::isnan left, where I don't have an idea what boost returns

if (!boost::math::isnan (it_n->getNormalVector4fMap ()))

Error during compiling with Clang 6, if I replace this line:

/media/sf_pcl/apps/in_hand_scanner/src/input_data_processing.cpp:249:10: error: no matching function for call to 'isnan'
    if (!std::isnan (it_n->getNormalVector4fMap ()))
         ^~~~~~~~~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/cmath:618:3: note: candidate function not viable: no known conversion from 'pcl::Vector4fMapConst' (aka 'const Map<const Matrix<float, 4, 1>, Eigen::Aligned>') to 'float' for 1st argument
  isnan(float __x)
  ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/cmath:626:3: note: candidate function not viable: no known conversion from 'pcl::Vector4fMapConst' (aka 'const Map<const Matrix<float, 4, 1>, Eigen::Aligned>') to 'double' for 1st argument
  isnan(double __x)
  ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/cmath:631:3: note: candidate function not viable: no known conversion from 'pcl::Vector4fMapConst' (aka 'const Map<const Matrix<float, 4, 1>, Eigen::Aligned>') to 'long double' for 1st argument
  isnan(long double __x)
  ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/cmath:639:5: note: candidate template ignored: substitution failure [with _Tp = Eigen::Map<const Eigen::Matrix<float, 4, 1, 0, 4, 1>, 16, Eigen::Stride<0, 0> >]: no type named '__type' in '__gnu_cxx::__enable_if<false, bool>'
    isnan(_Tp __x)
    ^
1 error generated.

Any idea what do to with this line? (I have no OpenNI on my debug machine, so I cannot step into and see what the code is doing)

@taketwo
Copy link
Member

taketwo commented Feb 2, 2019

I think the line in question can be replaced with:

if (!it_n->getNormalVector4fMap ().hasNaN ())

@taketwo taketwo added the c++14 label Feb 2, 2019
@SunBlack
Copy link
Contributor Author

SunBlack commented Feb 2, 2019

Sure we don't change behavior with this change (compared to now)?

@taketwo
Copy link
Member

taketwo commented Feb 2, 2019

I think what I suggested will work the way the author intended. I'm not sure if the current code behaves the same though. I don't understand how it's possible that boost::math::isnan supports an Eigen type argument.

@SergioRAgostinho SergioRAgostinho merged commit 079f634 into PointCloudLibrary:master Feb 3, 2019
@SunBlack SunBlack deleted the replace_boost_isnan branch February 4, 2019 12:33
@taketwo taketwo changed the title Replace boost::math::isnan by std::isnan Migrate from boost::math::isnan to std::isnan Jan 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants