diff options
author | Gard Spreemann <gspreemann@gmail.com> | 2018-06-15 12:42:55 +0200 |
---|---|---|
committer | Gard Spreemann <gspreemann@gmail.com> | 2018-06-15 12:42:55 +0200 |
commit | c31bac6af57af917b8f799d0c21eb6af34ee1f6e (patch) | |
tree | 5a9603a4ec016f1aa09c7da52510790680c790c3 /include/gudhi/Bottleneck.h | |
parent | 02de1136cf9850803cb1e1ac1141f11b50be2992 (diff) | |
parent | 41482b4260b4aff3d6803e340d5c94fbefb9af67 (diff) |
Merge branch 'dfsg/latest' into debian/sid
Diffstat (limited to 'include/gudhi/Bottleneck.h')
-rw-r--r-- | include/gudhi/Bottleneck.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/include/gudhi/Bottleneck.h b/include/gudhi/Bottleneck.h index 7aee07bb..b0fc3949 100644 --- a/include/gudhi/Bottleneck.h +++ b/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); |