White space between '0x' is not accepted by mpz_set_str().

Niels Möller nisse at lysator.liu.se
Mon Dec 2 17:51:40 UTC 2013


Bernhard Kuemel <bernhard at bksys.at> writes:

> Maybe the manual should be improved.
>
> "Function: int mpz_set_str (mpz_t rop, const char *str, int base)
>
> Set the value of rop from str, a null-terminated C string in base base.
> White space is allowed in the string, and is simply ignored."

The TeXinfo spurce for the manual contains the following additional
comment:

@c  It turns out that it is not entirely true that this function ignores
@c  white-space.  It does ignore it between digits, but not after a minus sign
@c  or within or after ``0x''.  Some thought was given to disallowing all
@c  whitespace, but that would be an incompatible change, whitespace has been
@c  documented as ignored ever since GMP 1.

Not sure what we should do about this. I think allowing white space was
a mistake, so I'm tempted to replace the descriptino with something like

  For historical reasons, white space is allowed and ignored in the
  string (except [....]). Please do not depend on this behaviour; we may
  drop support for this feature in some future version.

I agree that the actually implemented rules should be documented.

Regards,
/Niels

-- 
Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.


More information about the gmp-bugs mailing list