Hi, together with Raphaël Rieu-Hleft (in cc), we believe we have found some dead code in mpn/generic/div_q.c around lines 173-182:
else if (UNLIKELY (qh != 0)) { /* This happens only when the quotient is close to B^n and mpn_*_divappr_q returned B^n. */ mp_size_t i, n; n = new_nn - dn; for (i = 0; i < n; i++) qp[i] = GMP_NUMB_MAX; qh = 0; /* currently ignored */ } Indeed, in the case cy <> 0, since cnt < GMP_NUMB_BITS, the most significant limb new_np[nn] of the dividend has at least one 0 leading bit, and thus is smaller than new_dp[dn-1] (which is normalized). Therefore qh is always 0 (no approximate division is performed here). Raphaël and Paul _______________________________________________ gmp-devel mailing list gmp-devel@gmplib.org https://gmplib.org/mailman/listinfo/gmp-devel