reporting bug

Felix Croteau felix at tiamatstudios.net
Mon Aug 1 00:07:37 CEST 2005


Hi, I am building application that need to calculate numbers up to 256^1048576

I have try this code I found at cppfrance.com it is for vc++ 6.0

It working #1.

-------------------------------------------------------------------------------------------------------------------------------------

#include "include/gmp.h"

using namespace std;

int n = 2;

int main()
{

 mpz_t  nbre;      // Define a number.
 mpz_init(nbre);      // Initialise the variable

 mpz_add_ui(nbre, nbre, n);

   
 mpz_pow_ui(nbre, nbre, 1048576);
 mpz_sub_ui(nbre, nbre, 1); 

 gmp_printf("%Zd", nbre);

 //cout << nbre;

 return 0;

}
-------------------------------------------------------------------------------------------------------------------------------------

But if n = 256 instead of 2 I got the following error:

The exception unknown software exception (0xc00000fd) occurred in the application at location 0x0042e957.

I try it without gmp_prtinf() and it work fine. Its like gmp_priint crash because the number to show have too digits. Because it work fine with a number like 2.

It is a bug of gmp or my code doing something wrong ?

Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gmplib.org/list-archives/gmp-bugs/attachments/20050801/8bc714d1/attachment.html


More information about the gmp-bugs mailing list