Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
CLHEP
CLHEP
Commits
43c3123e
Commit
43c3123e
authored
Jun 30, 2004
by
Lynn Garren
Browse files
Geant4 still uses sqr instead of sqrt in places
parent
9f93e9ec
Changes
2
Hide whitespace changes
Inline
Side-by-side
config/config/TemplateFunctions.h
View file @
43c3123e
...
...
@@ -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
config/test/testConfig.cc
View file @
43c3123e
// -*- 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
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment