Minh Nguyen <md6nguyen@yahoo.com> writes: > > Why does GMP have to reallocate memory when it is not necessary? Generally to keep size calculations simpler and smaller. There's no sense making a complicated calculation just to shave one or two limbs in certain cases. It's left up to each mpz function to decide what it would like to have, it just has to call MPZ_REALLOC and friends.