Lazy mpz allocation

Niels Möller nisse at
Wed May 4 09:29:44 UTC 2016

tg at (Torbjörn Granlund) writes:

> I forgot about that we need to have an explicit denominator.
> We could surely point that to some static read-only data, but that would
> of course incur a cost when "re-allocating".

I'm not familiar with mpq internals, but I guess it might be possible to
get away with leaving the denominator as zero on initialization.

Then one would need to follow the convention that if numerator is zero,
then the denominator is ignored. Or (but I guess that's more cumbersome)
adapt the convention that zero denominator means "this is an integer",
and treated as one.


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

More information about the gmp-devel mailing list