[Mpc-discuss] infinite with log10(0+1*I)

Mickael Gastineau gastineau at imcce.fr
Sat Sep 29 13:43:44 CEST 2012


It seems that the function log10 goes to an infinite loop if it is called with (0 1).
I attach a small program to reproduce it.
The loop seems to be inside the function mpc_log10_aux.
The problem occurs only if the real part is exactly 0.

I try it with mpc 1.0.1/mpfr 3.1.1/gmp 5.0.5 on mac os X.

Mickaël
-------------- section suivante --------------
#include <stdio.h>
#include <mpc.h>
#include <mpfr.h>

int
main (void)
{
  mpc_t a, b;

  mpc_init2 (a, 53);
  mpc_init2 (b, 53);
  mpc_set_str (a, "(1E-100 1)", 0, MPC_RNDNN);
  mpc_log10 (b, a, MPC_RNDNN);
  mpc_out_str (stdout, 10, 40, b, MPC_RNDNN);
  putc ('\n', stdout);
  mpc_set_str (a, "(0 1)", 0, MPC_RNDNN);
  mpc_log10 (b, a, MPC_RNDNN);
  mpc_out_str (stdout, 10, 40, b, MPC_RNDNN);
  putc ('\n', stdout);

  return 0;
}


More information about the Mpc-discuss mailing list