Is there a way to get the number of bits in an mpz_t?

Chris Saunders evas at mountaincable.net
Tue Sep 22 10:52:25 CEST 2009


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.

Regards
Chris Saunders

----- Original Message ----- 
From: "Sisyphus" <sisyphus1 at optusnet.com.au>
To: "Chris Saunders" <evas at mountaincable.net>; "GMP-discuss Mailing List" 
<gmp-discuss at gmplib.org>
Sent: Tuesday, September 22, 2009 3:51 AM
Subject: Re: Is there a way to get the number of bits in an mpz_t?


>
> ----- Original Message ----- 
> From: "Chris Saunders" <evas at mountaincable.net>
>
>> I'm looking for a method to get the number of bits in an mpz_t.  Thanks 
>> for any assistence.
>
> Hi Chris,
>
> 'mpz_sizeinbase(op, 2);' will return that.
> See 
> http://gmplib.org/manual/Miscellaneous-Integer-Functions.html#index-mpz_005fsizeinbase-463
>
> Cheers,
> Rob
> 



More information about the gmp-discuss mailing list