mpz_get_ld

Zimmermann Paul Paul.Zimmermann at loria.fr
Mon Jun 18 20:38:56 CEST 2012


       Hi,

I am contributing the following function:

long double
mpz_get_ld (mpz_t z)
{
  double h, l;
  mpz_t tmp;
  
  h = mpz_get_d (z);
  mpz_init (tmp);
  mpz_set_d (tmp, h);
  mpz_sub (tmp, tmp, z);
  l = mpz_get_d (tmp);
  mpz_clear (tmp);
  return (long double) h + (long double) l;
}

Paul


More information about the gmp-devel mailing list