Reason for definition of precomputed reciprocals
Albin Ahlbäck
ahlback at lix.polytechnique.fr
Thu Jun 25 09:07:55 CEST 2026
Hi,
I'm currently writing routines for computing integer reciprocals, and
I'm wondering why the definition is `floor((B^2 - 1) / d) - B' instead
of `floor(B^2 / d) - B - 1'. The current definition yields a slightly
faster final iteration written this way, but seemingly at the cost of
introducing another branch in the division with precomputed reciprocals.
@Torbjörn and Niels, what is the reason behind this definition?
Best,
Albin
More information about the gmp-devel
mailing list