Base (2 to 62) limitation for set_str initialization and output

bodrato at mail.dm.unipi.it bodrato at mail.dm.unipi.it
Thu Dec 13 09:21:15 CET 2012


Ciao,

Il Mer, 12 Dicembre 2012 3:53 pm, Sergio Martin ha scritto:
>> I'm honestly curious as to what space you are hoping to spare. I did some

> Yes, I was careless about estimating the space savings of using a raw
> binary number instead of the base 62 representation. Both you and
> Torbjorn corrected me in this aspect.
>
> However marginal the saving might be, it is still important for what I'm
> currently studying.

Using a power-of-two base, you also save time, because conversion to/from
the internal representation is easier. This is one more reason for using
mpz_inp_raw and mpz_out_raw instead of the _str variants.

You can also use mpz_import and mpz_export if you want to cook your own
format: http://gmplib.org/manual/Integer-Import-and-Export.html .

Regards,
Marco

-- 
http://bodrato.it/papers/



More information about the gmp-discuss mailing list