i have a problem with GMP library for big integer. I set the big integer using the function
mpz_t num;
mpz_init(num);
mpz_set_str(num,"12345678901234567890开发者_如何学Go1234567890123456789012345678901234567890123456789012341234567890123456789012345678901234567890123456789012345678901234567890123412345678901234567890123456789012345678901234567890123456",10);
When i print this number gmp_printf("%Zd",num) the result is wrong. Are there any limitations? Is the number too big? i don't think ...
Try this:
mpf_set_default_prec(5*1024);
before your mpz_init.
Good Luck!
Maybe the problem is that you didn't initialize num. The GMP functions for integer arithmetic assume that all integer objects are initialized.
mpz_init(num);
精彩评论