[Mpc-discuss] Bug in gmp/mpfr/mpc, never ending ctan computation

Andreas Enge andreas.enge at inria.fr
Mon Nov 19 13:28:49 UTC 2018

Hello all,

On Mon, Nov 19, 2018 at 12:37:16PM +0100, Torbjörn Granlund wrote:
> I'll leave this up to the mpc maintainers.

indeed I suggest to continue the discussion only on the mpc mailing list;
this is clearly not a bug of gmp.

>   > I simplified your test case using 1 as the real part and an integer for
>   > the imaginary part.  With the real part set to 10000, the computation
>   > finishes in about 10 seconds, with every doubling of it the runtime
>   > almost triples.  (If my observation generalises to an extended real part
>   > range, the compilation for your test case should terminate in about
>   > 10*3^log2(4.045689747817175388336181640625e+8/10000)/3600/24/365 years.)
>   Ick.  I wonder if the actual ctan result is infinite or we just
>   fail to compute it in an efficient manner...
> The result should be extremely small, so returning Inf would be
> quite inaccurate.  :-)

More precisely, the result is essentially epsilon1+(1+epsilon2)*I;
and the mpc function returns round(epsilon1)+1*I with an additional value
indicating the sign of the error made by dropping epsilon2. For this,
an extremely high precision is needed (essentially, as many bits as
the exponent of epsilon2).


More information about the gmp-bugs mailing list