Re: mpz_get_ld

2012-06-18 Thread Zimmermann Paul
Marc, > If the function mpz_get_ld is provided, I expect it to work for the whole > (exponent) range of long double value, not just the range of double. > Should we first do something about large z, then apply your method and fix > the result with ldexpl? you are right. Here is an impro

Re: mpz_get_ld

2012-06-18 Thread Marc Glisse
On Mon, 18 Jun 2012, Zimmermann Paul wrote: 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 +

mpz_get_ld

2012-06-18 Thread Zimmermann Paul
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; } Pau