Advertisement
PVS-StudioWarnings

PVS-Studio warning V624 for Geant4

Nov 20th, 2014
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.85 KB | None | 0 0
  1. G4double G4ElasticHadrNucleusHE::
  2.    HadrNucDifferCrSec(G4int Nucleus, G4double aQ2)
  3. {
  4.   ....
  5.   dSigPodT = HadrTot*HadrTot*(1+HadrReIm*HadrReIm)*
  6.                (
  7.                 Coeff1*std::exp(-Slope1*SqrQ2)+
  8.                 Coeff2*std::exp( Slope2*(ConstU)+aQ2)+
  9.                 (1-Coeff1-Coeff0)*std::exp(-HadrSlope*aQ2)+
  10.                +Coeff0*std::exp(-Slope0*aQ2)
  11.                 )/16/3.1416*2.568;
  12.   ....
  13. }
  14.  
  15. This suspicious code was found in Geant4 project by PVS-Studio static code analyzer.
  16. Warning message is:
  17. 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
  18.  
  19. 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
Advertisement