PVS-StudioWarnings

PVS-Studio warning V550 for ffdshow

Nov 17th, 2014
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.69 KB | None | 0 0
  1. static void av_build_filter(....)
  2. {
  3.   ....
  4.   x = M_PI * ((double)(i - center) -
  5.               (double)ph / phase_count) * factor;
  6.   if (x == 0) y = 1.0;
  7.   else        y = sin(x) / x;
  8.   ....
  9. }
  10.  
  11. It's strange to expect 'x' to exactly equal 0 after all these calculations.
  12.  
  13. This suspicious code was found in ffdshow project by PVS-Studio static code analyzer.
  14. Warning message is:
  15. V550 An odd precise comparison: x == 0. It's probably better to use a comparison with defined precision: fabs(A - B) < Epsilon. resample2.cpp 166
  16.  
  17. PVS-Studio is a static analyzer for detecting bugs in the source code of applications written in C, C++, C++11, C++/CX. Site: http://www.viva64.com/en/pvs-studio/
Advertisement
Add Comment
Please, Sign In to add comment