converting from GMP to QD

Pasquale Tricarico tricaric at psi.edu
Wed Aug 1 05:44:59 CEST 2012


Hi,

I am currently using both GMP and QD libraries, converting from mpz to
dd_real using something like this:

    dd_real mpzToDD(const mpz_class & z) {
        char * str = (char *)malloc(mpz_sizeinbase(z.get_mpz_t(),10)+2);
        mpz_get_str(str,10,z.get_mpz_t());
        dd_real x(str);
        free(str);
        return x;
    }

I would be interested in knowing if there is a more efficient way to do this.

Thanks,

Pasquale

--
Pasquale Tricarico, Ph.D.
Planetary Science Institute
http://orbit.psi.edu/~tricaric


More information about the gmp-discuss mailing list