Reduced number of allocated limbs after calling mpz_remove
Albin Ahlbäck
albin.ahlback at gmail.com
Thu May 16 14:38:28 CEST 2024
Hello,
Standing at the following commit:
changeset: 18465:7ecb3b2beea1
tag: tip
user: Niels Möller <nisse at lysator.liu.se>
date: Sun Feb 18 20:20:57 2024 +0100
summary: mini-gmp: Fix bug in gcdext canonicalization, and
strengthen related tests.
I have noticed that `mpz_remove` may reduce the number of allocated
limbs after a call.
I haven't looked into this too much, but I suppose it is due to the
variable `x` being initialized in the routine, whose limbs I believe are
allocated in `mpz_tdiv_q`, is then being swapped with `dest`.
It is stated in the documentation that "mpz_t and mpq_t variables never
reduce their allocated space.", which is sort of true given that `x` and
`dest` are only being swapped, but that requires the user to know what
the internals are doing.
Is this the expected behavior? Have I overlooked something perhaps?
Please let me know if you need more information.
Best,
Albin
More information about the gmp-bugs
mailing list