Inconsistent string conversions

Torbjörn Granlund tg at gmplib.org
Tue Sep 5 18:19:30 UTC 2017


Austyn Krutsinger <akrutsinger at gmail.com> writes:

  mpz_set_str(a, "1234    56789", 10); /* a = 123456789 */
  
That behaviour is intentional, but not a design decision I am proud of.

I believe mpz_inp_str is more reasonably designed (although I'd have
named in mpz_in_str today...).

We should perhaps change it incompatibly, or declare mpz_set_str as
obsolete and provide a more versatile function in the spirit of
strtol/strtod.

See also <https://gmplib.org/devel/incompatibility.html>.

-- 
Torbjörn
Please encrypt, key id 0xC8601622


More information about the gmp-discuss mailing list