Use isnan in DepthImageOctomapUpdater#2201
Conversation
ChrisThrasher
left a comment
There was a problem hiding this comment.
Common SonarCloud W
|
|
||
| // if there are any NaNs, discard data | ||
| if (!(px == px && py == py && inv_fx_ == inv_fx_ && inv_fy_ == inv_fy_)) | ||
| if (isnan(px) || isnan(py) || isnan(inv_fx_) || isnan(inv_fy_)) |
There was a problem hiding this comment.
isnan() from the C standard library is actually an implementation-defined macro where as std::isnan() from the C++ standard library is a proper function and overloaded on all floating point types. I doubt the difference matters but I wanted to point that out.
There was a problem hiding this comment.
huh, I was confused by exactly that cppreference page
Instead of relying on the fact that `NaN != NaN`.
0d8a391 to
6cc45f4
Compare
Codecov ReportPatch coverage has no change and project coverage change:
Additional details and impacted files@@ Coverage Diff @@
## main #2201 +/- ##
==========================================
+ Coverage 50.56% 50.56% +0.01%
==========================================
Files 387 387
Lines 31740 31740
==========================================
+ Hits 16045 16047 +2
+ Misses 15695 15693 -2 ☔ View full report in Codecov by Sentry. |
Description
Uses
std::isnanfor a particularly nasty conditional we saw in the Sonar scan that haunted me, instead of relying on the fact thatNaN != NaN.