Regarding power function

delta trinity deltatrinity@hotmail.com
Wed, 12 Feb 2003 22:52:15 -0500


>Hello!
>     Iam implementing a program using gmp lib. But i
>wasnt able to do a^b because gmp doesnt have that
>function where as it has a^b mod c.
>       It would be great if any one of you would let me
>know is there any power function to calculate power of
>an mpz_t type of variable.
>
>thanking you
>Hari

There is a function (mpz_pow_ui and mpz_ui_pow_ui).  It take either a mpz or 
unsigned integer as a base and have to be unsigned integer as exponent.  The 
reason for UI as exponent is that it would make no sense having too high 
exponent.  Ex, the maximum exponent with 32 bits unsigned is 4294967295 
(2^32-1).  And with lowest base (2), 2^4294967295 couldn't be allocated in 
memory.

_________________________________________________________________
Help STOP SPAM with the new MSN 8 and get 2 months FREE*  
http://join.msn.com/?page=features/junkmail