Examples of errors detected by the V624 diagnostic

V624. The constant NN is being utilized. The resulting value could be inaccurate. Consider using the M_NN constant from <math.h>.


ffdshow

V624 The constant 3.1415926 is being utilized. The resulting value could be inaccurate. Consider using the M_PI constant from <math.h>. timgfilterchroma.cpp 34


TimgFilterChroma::TimgFilterChroma(....)
{
  ....
  for (int i = -180, ii = 0; i <= 180; ii++, i++) {
    double Hue = (i * 3.1415926) / 180.0;
    hueSin[ii] = short(sin(Hue) * 128);
    hueCos[ii] = short(cos(Hue) * 128);
  }
  ....
}

ffdshow

V624 The constant 3.1415 is being utilized. The resulting value could be inaccurate. Consider using the M_PI constant from <math.h>. trenderedtextsubtitleword.cpp 290

V624 The constant 3.1415 is being utilized. The resulting value could be inaccurate. Consider using the M_PI constant from <math.h>. trenderedtextsubtitleword.cpp 291

V624 The constant 3.1415 is being utilized. The resulting value could be inaccurate. Consider using the M_PI constant from <math.h>. trenderedtextsubtitleword.cpp 292

V624 The constant 3.1415 is being utilized. The resulting value could be inaccurate. Consider using the M_PI constant from <math.h>. trenderedtextsubtitleword.cpp 293

V624 The constant 3.1415 is being utilized. The resulting value could be inaccurate. Consider using the M_PI constant from <math.h>. trenderedtextsubtitleword.cpp 294

V624 The constant 3.1415 is being utilized. The resulting value could be inaccurate. Consider using the M_PI constant from <math.h>. trenderedtextsubtitleword.cpp 295


void TrenderedTextSubtitleWord::Transform(CPoint org)
{
  ....
  double caz = cos((3.1415 / 180) * mprops.angleZ);
  double saz = sin((3.1415 / 180) * mprops.angleZ);
  double cax = cos((3.1415 / 180) * mprops.angleX);
  double sax = sin((3.1415 / 180) * mprops.angleX);
  double cay = cos((3.1415 / 180) * mprops.angleY);
  double say = sin((3.1415 / 180) * mprops.angleY);
  ....
}

OpenMS

V624 The constant 3.14159 is being utilized. The resulting value could be inaccurate. Consider using the M_PI constant from <math.h>. posteriorerrorprobabilitymodel.c 92


bool PosteriorErrorProbabilityModel::fit(
  std::vector<double> & search_engine_scores)
{
  ....
  incorrectly_assigned_fit_param_.A =
    1 / sqrt(2 * 3.14159 *
             pow(incorrectly_assigned_fit_param_.sigma, 2));
  ....
}

Identical errors can be found in some other places:

  • V624 The constant 3.14159 is being utilized. The resulting value could be inaccurate. Consider using the M_PI constant from <math.h>. posteriorerrorprobabilitymodel.c 101
  • V624 The constant 3.14159 is being utilized. The resulting value could be inaccurate. Consider using the M_PI constant from <math.h>. posteriorerrorprobabilitymodel.c 110
  • V624 The constant 3.14159 is being utilized. The resulting value could be inaccurate. Consider using the M_PI constant from <math.h>. posteriorerrorprobabilitymodel.c 155
  • And 1 additional diagnostic messages.

Geant4 software

V624 The constant 3.1416 is being utilized. The resulting value could be inaccurate. Consider using the M_PI constant from <math.h>. g4elastichadrnucleushe.cc 750


G4double G4ElasticHadrNucleusHE::
   HadrNucDifferCrSec(G4int Nucleus, G4double aQ2)
{
  ....
  dSigPodT = HadrTot*HadrTot*(1+HadrReIm*HadrReIm)*
               (
                Coeff1*std::exp(-Slope1*SqrQ2)+
                Coeff2*std::exp( Slope2*(ConstU)+aQ2)+
                (1-Coeff1-Coeff0)*std::exp(-HadrSlope*aQ2)+
               +Coeff0*std::exp(-Slope0*aQ2)
                )/16/3.1416*2.568;
  ....
}

Identical errors can be found in some other places:

  • V624 The constant 0.785398164 is being utilized. The resulting value could be inaccurate. Consider using the M_PI_4 constant from <math.h>. g4diffuseelastic.hh 285
  • V624 The constant 0.636619772 is being utilized. The resulting value could be inaccurate. Consider using the M_2_PI constant from <math.h>. g4diffuseelastic.hh 297
  • V624 The constant 0.636619772 is being utilized. The resulting value could be inaccurate. Consider using the M_2_PI constant from <math.h>. g4diffuseelastic.hh 348
  • And 67 additional diagnostic messages.

Inkscape

V624 The constant 0.707107 is being utilized. The resulting value could be inaccurate. Consider using the M_SQRT1_2 constant from <math.h>. PathOutline.cpp 1198


void
Path::OutlineJoin (....)
{
  ....
  if (fabs(c2) > 0.707107) {
    ....
  }
  ....
}

Identical errors can be found in some other places:

  • V624 The constant 1.414213562 is being utilized. The resulting value could be inaccurate. Consider using the M_SQRT2 constant from <math.h>. verbs.cpp 1848
  • V624 The constant 3.14159 is being utilized. The resulting value could be inaccurate. Consider using the M_PI constant from <math.h>. odf.cpp 1568
  • V624 The constant 1.414213562 is being utilized. The resulting value could be inaccurate. Consider using the M_SQRT2 constant from <math.h>. inkscape-preferences.cpp 1334


Do you make errors in the code?

Check your code
with PVS-Studio

Static code analysis
for C, C++ and C#

goto PVS-Studio;