Best way to get ceil(log2(x)) of a BigInt?
Andrea Fontana via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Nov 2 08:51:38 PDT 2016
On Wednesday, 2 November 2016 at 15:15:18 UTC, Andrea Fontana
wrote:
> Why don't you perform a binary search over 200 power of 2?
Something like: http://paste.ofcode.org/scMD5JbmLMZkrv3bWRmPPT
I wonder if a simple binary search on whole array is faster than
search for limits as in this example
PS: If you need ceil, just use the else branch with <= instead of
<.
Andrea
More information about the Digitalmars-d-learn
mailing list