Is there a way to get the number of bits in an mpz_t?
Sisyphus
sisyphus1 at optusnet.com.au
Tue Sep 22 11:20:18 CEST 2009
----- Original Message -----
From: "Chris Saunders" <evas at mountaincable.net>
To: "Sisyphus" <sisyphus1 at optusnet.com.au>; "GMP-discuss Mailing List"
<gmp-discuss at gmplib.org>
Sent: Tuesday, September 22, 2009 6:52 PM
Subject: Re: Is there a way to get the number of bits in an mpz_t?
> First, thanks very much for the response Rob. I didn't see how to get
> what I was after at first but realized after a minute. Can I ask you to
> confirm that calling mpz_sizeinbase (my_mpz, 2) will return what I'm
> looking for.
Yes, that will do it ... assuming I understand correctly what it is that
you're "looking for" :-)
For example, it will return '4' for the values 8 to 15 (inclusive).
Cheers,
Rob
More information about the gmp-discuss
mailing list