MPFR is missing a "mpfr_ui_div_ui"
% Remco Bloemen % 2009-11-24, last updated 2014-03-03
Strangely, MPFR is lacking a mpfr_ui_div_ui
function, that is, a function that calculates the fraction of two small
unsigned integers to very high accuracy. Until now I’ve been calculating
it like this:
;
;
which is very slow! The reason is probably that the mpfr_ui_div
is
calculated using all bits in invprime
, even though most of them are
zero. A much faster method is to prepare a two-bit one
constant like
this:
mpfr_t one;
;
;
and then do this:
;