Commit 43c3123e authored by Lynn Garren's avatar Lynn Garren
Browse files

Geant4 still uses sqr instead of sqrt in places

parent 9f93e9ec
......@@ -2,7 +2,7 @@
#ifdef ENABLE_BACKWARDS_COMPATIBILITY
// -*- C++ -*-
// CLASSDOC OFF
// $Id: TemplateFunctions.h,v 1.1.2.1 2004/06/30 15:22:26 garren Exp $
// $Id: TemplateFunctions.h,v 1.1.2.2 2004/06/30 15:38:30 garren Exp $
// ---------------------------------------------------------------------------
// CLASSDOC ON
//
......@@ -21,6 +21,18 @@
using namespace std;
// Geant 4.6.2 still has at least one reference to sqr
#ifndef CLHEP_SQR_DEFINED
#define CLHEP_SQR_DEFINED
#ifdef sqr
#undef sqr
#endif
template <class T>
inline T sqr(const T& x) {
return x*x;
}
#endif
#endif /* HEP_TEMPLATEFUNCTIONS_H */
#endif // ENABLE_BACKWARDS_COMPATIBILITY
// -*- C++ -*-
// $Id: testConfig.cc,v 1.1.2.1 2004/06/30 15:22:26 garren Exp $
// $Id: testConfig.cc,v 1.1.2.2 2004/06/30 15:38:30 garren Exp $
// ---------------------------------------------------------------------------
//
// This file is a part of the CLHEP - a Class Library for High Energy Physics.
......@@ -21,7 +21,7 @@ int main() {
const double db=4.;
double mpi = M_PI;
HepStd::cout << "use obsolete HepStd" << HepStd::endl;
// test M_PI and HepStd
HepStd::cout << "pi mass is " << mpi << HepStd::endl;
// Test min()
......@@ -40,6 +40,17 @@ int main() {
assert(max(fa,fb) == 4.);
assert(max(da,db) == 4.);
// Test sqr()
assert(sqr(3) == 9);
assert(sqr(ia) == 9);
assert(sqr(ib) == 16);
assert(sqr(3.) == 9.);
assert(sqr(fa) == 9.);
assert(sqr(fb) == 16.);
assert(sqr(da) == 9.);
assert(sqr(db) == 16.);
// Test abs()
assert(abs(3) == 3);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment