documentation on internals not up to date

Niels Möller nisse at
Fri Apr 27 11:52:54 UTC 2018

Marc Glisse <marc.glisse at> writes:

> There would be a significant advantage to mpq if we could have a
> non-allocated 1 for the denominator. But indeed, with the current code
> where only some mpz functions would work, it seems safer to document
> that none work.

We could do that internally, even if we don't advertise it for other gmp
users. Then mpq_init wouldn't do any allocation, right? We could have a
single mpq object representing 0/1 with _mp_alloc == 0 for both parts,
and initialize with struct assignment or memcpy.

We would just ensure that mpz realloc keeps supporting thuis case.


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

More information about the gmp-devel mailing list