diff options
author | svnadmin <svnadmin@f88db872-0e4f-0410-b76b-b9085cfa78c5> | 2008-06-26 13:51:26 +0000 |
---|---|---|
committer | svnadmin <svnadmin@f88db872-0e4f-0410-b76b-b9085cfa78c5> | 2008-06-26 13:51:26 +0000 |
commit | 9716af1598ddfd2ab8ee7198b35cca1df312c4fd (patch) | |
tree | 5f903e795434362f0360ee2e3e65a27e6c6601c3 /src/jtutil/fuzzy.cc | |
parent | 8cb0df53b3d5d615624b9bffdcc11cf13905cfc0 (diff) |
Make "Erik" branch the default trunk for AHFinderDirect.
git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinAnalysis/AHFinderDirect/trunk@1526 f88db872-0e4f-0410-b76b-b9085cfa78c5
Diffstat (limited to 'src/jtutil/fuzzy.cc')
-rw-r--r-- | src/jtutil/fuzzy.cc | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/src/jtutil/fuzzy.cc b/src/jtutil/fuzzy.cc index e444c30..d3e4314 100644 --- a/src/jtutil/fuzzy.cc +++ b/src/jtutil/fuzzy.cc @@ -11,39 +11,40 @@ // #include <stdlib.h> -#include <stdio.h> #include "stdc.h" #include "util.hh" -// everything in this file is inside these namespaces -namespace AHFinderDirect - { -namespace jtutil - { - //****************************************************************************** +namespace jtutil + { template <typename fp_t> bool fuzzy<fp_t>::EQ(fp_t x, fp_t y) { -fp_t max_abs = max(jtutil::abs(x), jtutil::abs(y)); -fp_t epsilon = max(tolerance_, tolerance_*max_abs); +fp_t max_abs = jtutil::max(jtutil::abs(x), jtutil::abs(y)); +fp_t epsilon = jtutil::max(tolerance_, tolerance_*max_abs); return jtutil::abs(x-y) <= epsilon; } + } // namespace jtutil:: //****************************************************************************** +namespace jtutil + { template <typename fp_t> bool fuzzy<fp_t>::is_integer(fp_t x) { int i = round<fp_t>::to_integer(x); return EQ(x, fp_t(i)); } + } // namespace jtutil:: //****************************************************************************** +namespace jtutil + { template <typename fp_t> int fuzzy<fp_t>::floor(fp_t x) { @@ -51,9 +52,12 @@ return fuzzy<fp_t>::is_integer(x) ? round<fp_t>::to_integer(x) : round<fp_t>::floor(x); } + } // namespace jtutil:: //****************************************************************************** +namespace jtutil + { template <typename fp_t> int fuzzy<fp_t>::ceiling(fp_t x) { @@ -61,6 +65,7 @@ return fuzzy<fp_t>::is_integer(x) ? round<fp_t>::to_integer(x) : round<fp_t>::ceiling(x); } + } // namespace jtutil:: //****************************************************************************** //****************************************************************************** @@ -75,6 +80,8 @@ return fuzzy<fp_t>::is_integer(x) // me figure out the correct syntax here! // +namespace jtutil + { // initializations of fuzzy::tolerance for each instantation we're going to make template <> float fuzzy<float>::tolerance_ = 1.0e-5; // about 100 * FLT_EPSILON @@ -85,10 +92,4 @@ template <> // template instantiations template class fuzzy<float>; template class fuzzy<double>; - -//****************************************************************************** -//****************************************************************************** -//****************************************************************************** - - } // namespace jtutil - } // namespace AHFinderDirect + } // namespace jtutil:: |