mini-gmp and scientific notation

Katelyn McNair deprekate at gmail.com
Tue Feb 14 21:39:14 UTC 2017


On Mon, Feb 13, 2017 at 11:52 PM, Marc Glisse <marc.glisse at inria.fr> wrote:

>
> We do try to make it portable, if it doesn't work for you you might want
> to report what fails...
>
> Forgive me if I am incorrect, but GMP is absolutely not portable (in the
sense that you can package it along with your own code).  GMP must be
downloaded, configured, compiled, installed, and set up for any piece of
code that wants to use it (these tasks were beyond the abilities of a small
test group of my end users).

Whereas with mini-gmp you only need to provide the .c and .h files with
your tarball.



> You could also try to use MPFR. I believe they tried to make it usable
> with mini-gmp, no promise though.
>

Hm, I might look it over.  I figure the best way would be to copy over the
sci-notation parsing code from mpz_set_str.   It would actually be nice to
have this handling available for integers, as it seems like reading in an
integer as a float (just for the sci-note parsing), then converting it back
to integer is rather circuitous.

     mpz_t a;
     mpf_t x;
     mpf_init_set_str(x, "3E+10", 10);
     mpz_set_f(a, x);





-- 
~Katelyn


More information about the gmp-discuss mailing list