Ciao,

I answer here to a question from gmp-discuss.

17 mar 2024, 01:28 da t...@gmplib.org:

> "website.reader" <website.rea...@protonmail.com> writes:
>
>  Here's the suggested fix for this command in a C++ code unit
>
This question arises once every couple of years, more or less...
Should we write a new mpz_sizeinbase_exactbutpossiblymuchslower() function?

Ideas:
 - use the vlog[] table we already have in mpn/generic/rootrem.c to compute 
some "decimal digits" of the logarithm base 2 of the number to more exactly 
discriminate within the "digits" and the "digits+1" case based on the higher 
bits of the number. This keeps on being O(1) but should narrow the range of 
cases where we need to
( - compute a sort of ui_powhi_ui  (we will have a use for mulhi :-), or 
finally)
 - compute ui_pow_ui and fully compare, giving the exact result.

Do you feel it may be useful? It would be more clever than what the user can 
simply do themself.
Ĝis,
mb
_______________________________________________
gmp-devel mailing list
gmp-devel@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-devel

Reply via email to