mpz_powm_sec confusion

Richard Damon Richard at Damon-Family.org
Wed May 31 19:44:25 UTC 2017


On 5/28/17 6:10 PM, Zachary Jensen wrote:
> Hi,
> I'm new to c++, but as a side project apart from my c++ course at school, I'm trying to create a function that calculates a number using mpz_powm_sec. The calculation works fine, and I can output the mpz_t rop with cout. For example:
> mpz_t a;mpz_init(a); //This is my rop.
> mpz_t b;mpz_init_set_ui(b, 12);
> ......
> mpz_powm_sec(a, b, ..., ...);cout << a;
>   I can't, however, store the answer in an int or long variable. I get the error "invalid conversion from 'mpz_struct*' to 'int'. [fpermissive]". For example:
> ......
> mpz_powm_sec(a, b, ..., ...);var = a;
>   I've tried so many things using the manual as a guide, but to no avail. I would sure be appreciative if you could explain to me how this is done (if it's even possible). Thanks!
>           -Zach
Did you look in the manual about conversion functions? (since you want 
to convert an mpz to a integer).

-- 
Richard Damon



More information about the gmp-discuss mailing list