Skip to content

Commit 9e7c2df

Browse files
committed
Fix 'transposition growth' computation for older compilers
The issue is probably due to some shenanigans with float-versus-double or converting size_t to double including some rounding up. Either way, it may introduce undefined behaviour or be interpreted multiple ways. This leads GCC 10 to unexpectedly abort repeated transposition.
1 parent 00b4df8 commit 9e7c2df

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/adiar/internal/algorithms/quantify.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -909,10 +909,10 @@ namespace adiar::internal
909909

910910
// Do Partial Quantification as long as...
911911
// 1. ... it stays smaller than 1+epsilon% of the input size.
912-
const size_t transposition__size_threshold = static_cast<size_t>(
913-
std::min<double>(std::numeric_limits<size_t>::max(),
914-
ep.template get<exec_policy::quantify::transposition_growth>()
915-
* static_cast<double>(dd_size)));
912+
const size_t transposition__size_threshold =
913+
(std::min(static_cast<double>(std::numeric_limits<size_t>::max() / 2u),
914+
static_cast<double>(ep.template get<exec_policy::quantify::transposition_growth>())
915+
* static_cast<double>(dd_size)));
916916

917917
// 2. ... it has not run more than the maximum number of iterations.
918918
const size_t transposition__max_iterations =

0 commit comments

Comments
 (0)