gmp_printf vs mpz_get_string
Joakim Carselind
joacar at kth.se
Mon Oct 15 15:05:55 CEST 2012
Hi,
Currently working on a project (Integer factorization) and have a question
about gmp_printf vs mpz_get_string.
Need to store the resulting factors in a buffer (2^100 max size so
char[201] to account for \n and \0) so currently I do the following
char buffer[31 * sizeof(char)];
void
addFactor(char * factors, mpz_t n)
{
mpz_get_string(buffer, 10, n);
// add each digit in buffer to factors array
}
Is calling mpz_get_string a significant overhead vs calling gmp_printf()?
IFF the factorization is known to be complete I can print the result
directly from where it was computed. This could be achieved by trial and
error using the tester.
Regards
More information about the gmp-discuss
mailing list