﻿ Examples of errors V550

Examples of errors detected by the V550 diagnostic

V550. An odd precise comparison. It's probably better to use 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

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

``````
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.

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.