Whitespace after minus sign in mpz_set_str

Vincent Lefevre vincent at vinc17.net
Mon May 8 11:33:44 CEST 2023

On 2023-05-07 15:37:12 +0200, Fredrik Johansson wrote:
> However, mpz_set_str returns that the string is invalid when a space
> appears between the minus sign and the first digit. For example,
>     mpz_set_str(x, "- 123", 10)
> does not work.

According to the GMP code (mpz/set_str.c), whitespace in the prefixes
0x/0X/0b/0B is not handled either.

Vincent Lefèvre <vincent at vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)

More information about the gmp-bugs mailing list