gmp_copy#

Return an independent copy of $x.

Because Math::GMP values are references to heap-allocated mpz_t structures, two Perl variables can share the same underlying integer. For the overloaded arithmetic operators that does not matter — they always allocate a fresh result. If you are about to call an in-place mutator (currently just add_ui_gmp) and want to keep the original intact, copy first.