Click or drag to resize
gmp_libmpz_remove Method
Remove all occurrences of the factor f from op and store the result in rop.

Namespace:  Math.Gmp.Native
Assembly:  Math.Gmp.Native (in Math.Gmp.Native.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
public static mp_bitcnt_t mpz_remove(
	mpz_t rop,
	mpz_t op,
	mpz_t f
)

Parameters

rop
Type: Math.Gmp.Nativempz_t
The result integer.
op
Type: Math.Gmp.Nativempz_t
The operand integer.
f
Type: Math.Gmp.Nativempz_t
The factor operand integer.

Return Value

Type: mp_bitcnt_t
The return value is how many such occurrences were removed.
Examples
// Create, initialize, and set the value of op to 45.
mpz_t op = new mpz_t();
gmp_lib.mpz_init_set_ui(op, 45U);

// Create, initialize, and set the value of f to 3.
mpz_t f = new mpz_t();
gmp_lib.mpz_init_set_ui(f, 3U);

// Create, initialize, and set the value of rop to 0.
mpz_t rop = new mpz_t();
gmp_lib.mpz_init(rop);

// Set rop = op / f^n, and return n, the largest integer greater than or equal to 0, such that f^n divides op.
Assert.IsTrue(gmp_lib.mpz_remove(rop, op, f) == 2);

// Assert that rop is 5.
Assert.IsTrue(gmp_lib.mpz_get_si(rop) == 5);

// Release unmanaged memory allocated for rop, op, and f.
gmp_lib.mpz_clears(rop, op, f, null);
See Also