Our website uses cookies to enhance your browsing experience.
Accept
to the top
close form

Fill out the form in 2 simple steps below:

Your contact information:

Step 1
Congratulations! This is your promo code!

Desired license type:

Step 2
Team license
Enterprise license
** By clicking this button you agree to our Privacy Policy statement
close form
Request our prices
New License
License Renewal
--Select currency--
USD
EUR
* By clicking this button you agree to our Privacy Policy statement

close form
Free PVS‑Studio license for Microsoft MVP specialists
* By clicking this button you agree to our Privacy Policy statement

close form
To get the licence for your open-source project, please fill out this form
* By clicking this button you agree to our Privacy Policy statement

close form
I am interested to try it on the platforms:
* By clicking this button you agree to our Privacy Policy statement

close form
check circle
Message submitted.

Your message has been sent. We will email you at


If you do not see the email in your inbox, please check if it is filtered to one of the following folders:

  • Promotion
  • Updates
  • Spam

Webinar: Evaluation - 05.12

>
>
>
Examples of errors detected by the V550…

Examples of errors detected by the V550 diagnostic

V550. Suspicious precise comparison. Consider using a comparison with defined precision: fabs(A - B) < Epsilon or fabs(A - B) > Epsilon.


CAMEL

V550 An odd precise comparison: x == 0. It's probably better to use a comparison with defined precision: fabs(A - B) '<' Epsilon. clock_dll sunalgo.cpp 155


void projillum(short* wtab, int xdots, int ydots, double dec)
{
  ....
  s = sin(-dtr(dec));
  x = -s * sin(th);
  y = cos(th);
  ....
  lon = (y == 0 && x == 0) ? 0.0 : rtd(atan2(y, x));
}

It's strange to expect 'x' and 'y' to exactly equal 0 after all these calculations.

Similar errors can be found in some other places:

  • V550 An odd precise comparison: y == 0. It's probably better to use a comparison with defined precision: fabs(A - B) '<' Epsilon. clock_dll sunalgo.cpp 155

ffdshow

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


static void av_build_filter(....)
{
  ....
  x = M_PI * ((double)(i - center) -
              (double)ph / phase_count) * factor;
  if (x == 0) y = 1.0;
  else        y = sin(x) / x;
  ....
}

It's strange to expect 'x' to exactly equal 0 after all these calculations.


Windows Calculator

V550 An odd precise comparison: ratio == threshold. It's probably better to use a comparison with defined precision: fabs(A - B) < Epsilon. Calculator AspectRatioTrigger.cpp 80


void AspectRatioTrigger::UpdateIsActive(Size sourceSize)
{
  double numerator, denominator;
  ....
  bool isActive = false;
  if (denominator > 0)
  {
    double ratio = numerator / denominator;
    double threshold = abs(Threshold);

    isActive = ((ratio > threshold) || (ActiveIfEqual && (ratio == threshold)));
  }

  SetActive(isActive);
}

Similar errors can be found in some other places:

  • V550 An odd precise comparison. It's probably better to use a comparison with defined precision: fabs(A - B) < Epsilon. CalcManager UnitConverter.cpp 752
  • V550 An odd precise comparison: stod(roundedString) != 0.0. It's probably better to use a comparison with defined precision: fabs(A - B) > Epsilon. CalcManager UnitConverter.cpp 778
  • V550 An odd precise comparison. It's probably better to use a comparison with defined precision: fabs(A - B) < Epsilon. CalcManager UnitConverter.cpp 790
  • And 9 additional diagnostic messages.

ArduPod

V550 An odd precise comparison: value != - 1. It's probably better to use a comparison with defined precision: fabs(A - B) > Epsilon. AP_Utils.cpp 574


float AP_Utils::sr04_average(uint8_t trig, uint8_t echo,
  int unit, int samples, int time) {
  ....
  float average, pause, value;
  ....
  for(int i=0; i<samples; i++) {
    value = sr04(trig, echo, unit);
    if(value != -1) { // <=
      total += value;
      delay(pause);
    } else {
      i--;
    }
  }
  average = total/samples;
  ....
  return average;
}