Skip to content

Commit

Permalink
fix isnan on _msvc_LANG>= 201103L (#417)
Browse files Browse the repository at this point in the history
  • Loading branch information
jiayuehua authored Apr 1, 2024
1 parent 3c268e8 commit eff7d05
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions octomap/src/compare_octrees.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#include <list>
#include <cmath>

#ifdef _MSC_VER // fix missing isnan for VC++
#if defined(_MSC_VER) && !((defined(_MSVC_LANG) && _MSVC_LANG >= 201103L) || __cplusplus >= 201103L)
#define isnan(x) _isnan(x)
#endif

Expand Down Expand Up @@ -132,11 +132,7 @@ int main(int argc, char** argv) {
else
kld +=log(p1/p2)*p1 + log((1-p1)/(1-p2))*(1-p1);

#if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201103L) || __cplusplus >= 201103L)
if (std::isnan(kld)){
#else
if (isnan(kld)){
#endif
OCTOMAP_ERROR("KLD is nan! KLD(%f,%f)=%f; sum = %f", p1, p2, kld, kld_sum);
exit(-1);
}
Expand Down

0 comments on commit eff7d05

Please sign in to comment.