Annoying mpz_set_str behaviour

Torbjorn Granlund tg at
Wed Feb 20 11:36:42 CET 2013

This call fails:

  mpz_set_str (z, "0xbade", 16)

Why?  Because when given an explicit base the 0x prefix is not allowed.
Do we really want it to work like that?

I have a vague feeling that this has been brought up in the past, but it
might have been forgotten.

I assume mpz_inp_str and perhaps some mpq or mpf function is also


More information about the gmp-devel mailing list