[Liblas-commits] hg: use epsilon test instead of direct float comparison

liblas-commits at liblas.org liblas-commits at liblas.org
Tue Aug 3 10:17:09 EDT 2010


changeset 87fac12b830a in /Volumes/Data/www/liblas.org/hg
details: http://hg.liblas.orghg?cmd=changeset;node=87fac12b830a
summary: use epsilon test instead of direct float comparison

diffstat:

 src/lasbounds.cpp |  7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diffs (17 lines):

diff -r 06239bc11752 -r 87fac12b830a src/lasbounds.cpp
--- a/src/lasbounds.cpp	Tue Aug 03 09:13:39 2010 -0500
+++ b/src/lasbounds.cpp	Tue Aug 03 09:17:04 2010 -0500
@@ -166,10 +166,9 @@
     {
         if (min(d) > max(d) )
         {
-            // FIXME: direct comparison of float-point may not be robust enough --mloskot
-            // check for infinitive region
-            if (!(min(d) == std::numeric_limits<double>::max() ||
-                 max(d) == -std::numeric_limits<double>::max() ))
+            // Check that we're not infinity either way
+            if (!(detail::compare_distance(min(d), std::numeric_limits<double>::max()) ||
+                  detail::compare_distance(max(d), -std::numeric_limits<double>::max()) ))
             {
                 std::ostringstream msg; 
                 msg << "liblas::Bounds::verify: Minimum point at dimension " << d


More information about the Liblas-commits mailing list