diff --git a/Shape_detection/include/CGAL/Shape_detection/Efficient_RANSAC/Shape_base.h b/Shape_detection/include/CGAL/Shape_detection/Efficient_RANSAC/Shape_base.h index 04b53b6c7af..21d21d13dab 100644 --- a/Shape_detection/include/CGAL/Shape_detection/Efficient_RANSAC/Shape_base.h +++ b/Shape_detection/include/CGAL/Shape_detection/Efficient_RANSAC/Shape_base.h @@ -623,10 +623,11 @@ namespace CGAL { const std::ptrdiff_t n, FT &low, FT &high) { - const FT q = FT(x * n * double(UN - x) * (UN - n) / (UN - 1)); + const FT xn = FT(double(x) * double(n)); + const FT q = FT(xn * double(UN - x) * (UN - n) / (UN - 1)); const FT sq = CGAL::sqrt(q); - low = (x * n - sq) / UN; - high = (x * n + sq)/UN; + low = (xn - sq) / UN; + high = (xn + sq)/UN; if (!is_finite(low) || !is_finite(high)) { low = high = 0;