[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gmp-devel
Subject:    Re: question on fixing the mpz_sizeinbase()
From:       marco.bodrato () tutanota ! com
Date:       2024-03-17 19:13:32
Message-ID: NtCpKlW--3-9 () tutanota ! com
[Download RAW message or body]

Ciao,

I answer here to a question from gmp-discuss.

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

> "website.reader" <website.reader@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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic