diff options
Diffstat (limited to 'src/jtutil/round.cc')
-rw-r--r-- | src/jtutil/round.cc | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/jtutil/round.cc b/src/jtutil/round.cc index 6559944..3c2d7e6 100644 --- a/src/jtutil/round.cc +++ b/src/jtutil/round.cc @@ -14,6 +14,12 @@ #include "stdc.h" #include "util.hh" +// everything in this file is inside these namespaces +namespace AHFinderDirect + { +namespace jtutil + { + //****************************************************************************** //****************************************************************************** //****************************************************************************** @@ -29,8 +35,6 @@ //****************************************************************************** // round to nearest integer, up for exact tie -namespace jtutil - { template <typename fp_t> int round<fp_t>::to_integer(fp_t x) { @@ -38,12 +42,9 @@ return (x >= 0.0) ? int(x + 0.5) // eg 3.6 --> int(4.1) = 4 : - int( (-x) + 0.5 ); // eg -3.6 --> - int(4.1) = -4 } - } // namespace jtutil:: //****************************************************************************** -namespace jtutil - { template <typename fp_t> int round<fp_t>::floor(fp_t x) { @@ -51,12 +52,9 @@ return (x >= 0.0) ? int(x) : - ceiling(-x); } - } // namespace jtutil:: //****************************************************************************** -namespace jtutil - { template <typename fp_t> int round<fp_t>::ceiling(fp_t x) { @@ -64,7 +62,6 @@ return (x >= 0.0) ? int(x) + (x != fp_t(int(x))) : - floor(-x); } - } // namespace jtutil:: //****************************************************************************** //****************************************************************************** @@ -74,5 +71,12 @@ return (x >= 0.0) // ***** template instantiations ***** // -template class jtutil::round<float>; -template class jtutil::round<double>; +template class round<float>; +template class round<double>; + +//****************************************************************************** +//****************************************************************************** +//****************************************************************************** + + } // namespace jtutil + } // namespace AHFinderDirect |