in the fn refmpn_tdiv_qr where int norm = refmpn_count_leading_zeros (dp[dsize-1]); .... ASSERT_NOCARRY(refmpn_lshift_or_copy(d2p,dp,dsize,norm)); the assertion clearly fails in the nails case shouldn't it read ? int norm = refmpn_count_leading_zeros (dp[dsize-1])-GMP_NAIL_BITS;