Re: mpz_limbs interface

2014-02-07 Thread Torbjorn Granlund
ni...@lysator.liu.se (Niels Möller) writes: Why isn't __gmp_extract_double's style OK for mpn_set_d? Is its conventions not neat enough, or are there efficiency reasons? I found the conventions of __gmp_extract_double hard to understand. And I think returning a base 2 exponent is

Re: mpz_limbs interface

2014-02-07 Thread Niels Möller
Torbjorn Granlund t...@gmplib.org writes: But then the shifting done in __gmp_extract_double will be needed in every caller. Or am I mistaken? I think you are right, for all current callers but one. The exception is mpq_set_d, which needs to remove trailing zero bits for normalization, using a

Re: mpz_limbs interface

2014-02-07 Thread bodrato
Ciao, Il Gio, 6 Febbraio 2014 2:08 pm, Niels ha scritto: Personally, I feel a bit easier about adding feature close to release, than about rewriting code for existing features. So, maybe we can discuss about adding a new function to the _limbs interface: mp_ptr mpz_init_limbs_write (mpz_t x,

Re: mpz_limbs interface

2014-02-07 Thread bodrato
Ciao, Il Gio, 6 Febbraio 2014 9:56 am, Niels ha scritto: What do you think? void mpz_set_d (mpz_ptr r, double d) { int negative; ! mp_limb_t tp[MPN_SET_D_SIZE]; ! mpz_t t = MPZ_ROINIT_N (tp, MPN_SET_D_SIZE); Uhm, in tests/mpz/t-limbs.c we test MPZ_ROINIT_N only #if

Re: mpz_limbs interface

2014-02-07 Thread Niels Möller
bodr...@mail.dm.unipi.it writes: Il Gio, 6 Febbraio 2014 9:56 am, Niels ha scritto: What do you think? void mpz_set_d (mpz_ptr r, double d) { int negative; ! mp_limb_t tp[MPN_SET_D_SIZE]; ! mpz_t t = MPZ_ROINIT_N (tp, MPN_SET_D_SIZE); Uhm, in tests/mpz/t-limbs.c we test