Segfault when calling mpf_get_str

Navid Roux n.roux at
Thu Sep 20 20:34:20 CEST 2012

Hello all,

I get a segmentation fault in my program when I call mpf_get_str().
I've found this mail in your archives:

So the error most likely comes from my code. It would be very unlikely that
GMP has a bug in a major function.

My system:
  - Windows 8 RTM 64-bit

  - MinGW with GCC 4.6.2

  - wxWidgets 2.9.4 (I only use wxWidgets for UI and threads)
  - GMP 5.05

All components were built using the stated compiler.

I thought you do not want the code to be here in the mail, so I've uploaded
it to - please don't worry - it is not too long, the
calculation section is just 12 LOC long.

The program calculates PI with this formula:
u_2n = 2 * n * sqrt( 0.5 - 0.5 * sqrt(1 - (u_n/n)²) );

or better using LaTex (copy the full URL!):\LARGE u_{2n} = 2 \cdot n \cdot
\sqrt{0.5 - 0.5 \cdot \sqrt{1 - (\frac{u_n}{n})^2}}

Many thanks in advance!!

Best Regards

More information about the gmp-discuss mailing list