diff options
author | vrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2018-07-02 09:46:08 +0000 |
---|---|---|
committer | vrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2018-07-02 09:46:08 +0000 |
commit | 9d1e8bcf6ee35b25a3e02b47a30a0b3cda89461d (patch) | |
tree | 9d8eb7e1bf90e8dcc4c3212cfe28312846391809 /src/Bottleneck_distance/include/gudhi/Bottleneck.h | |
parent | 4006d0f51dea0bf4234fbdc62b35fe71562293d8 (diff) | |
parent | 34d50c272e468e3cf39d18c7e43730274d936acd (diff) |
Merge last trunk modifications
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/python_nerve_gic_vincent@3656 636b058d-ea47-450e-bf9e-a15bfbe3eedb
Former-commit-id: 1f02e2f3b3e716d6578be49437e7d0b33fa99e5b
Diffstat (limited to 'src/Bottleneck_distance/include/gudhi/Bottleneck.h')
-rw-r--r-- | src/Bottleneck_distance/include/gudhi/Bottleneck.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/Bottleneck_distance/include/gudhi/Bottleneck.h b/src/Bottleneck_distance/include/gudhi/Bottleneck.h index 7aee07bb..b0fc3949 100644 --- a/src/Bottleneck_distance/include/gudhi/Bottleneck.h +++ b/src/Bottleneck_distance/include/gudhi/Bottleneck.h @@ -4,7 +4,7 @@ * * Author: Francois Godi * - * Copyright (C) 2015 INRIA + * Copyright (C) 2015 Inria * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -30,6 +30,7 @@ #include <limits> // for numeric_limits #include <cmath> +#include <cfloat> // FLT_EVAL_METHOD namespace Gudhi { @@ -43,6 +44,13 @@ double bottleneck_distance_approx(Persistence_graph& g, double e) { Graph_matching biggest_unperfect(g); while (b_upper_bound - b_lower_bound > 2 * e) { double step = b_lower_bound + (b_upper_bound - b_lower_bound) / alpha; +#if !defined FLT_EVAL_METHOD || FLT_EVAL_METHOD < 0 || FLT_EVAL_METHOD > 1 + // On platforms where double computation is done with excess precision, + // we force it to its true precision so the following test is reliable. + volatile double drop_excess_precision = step; + step = drop_excess_precision; + // Alternative: step = CGAL::IA_force_to_double(step); +#endif if (step <= b_lower_bound || step >= b_upper_bound) // Avoid precision problem break; m.set_r(step); |