Click or drag to resize
gmp_libmpq_set_z Method
Assign rop from op.

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 void mpq_set_z(
	mpq_t rop,
	mpz_t op
)

Parameters

rop
Type: Math.Gmp.Nativempq_t
The result rational.
op
Type: Math.Gmp.Nativempz_t
The operand integer.
Examples
// Create, initialize, and set a new rational x to 10 / 11.
mpq_t x = new mpq_t();
gmp_lib.mpq_init(x);
gmp_lib.mpq_set_si(x, 10, 11);

// Create, initialize, and set a new integer y to -210.
mpz_t y = new mpz_t();
gmp_lib.mpz_init(y);
gmp_lib.mpz_set_si(y, -210);

// Assign the value of y to x.
gmp_lib.mpq_set_z(x, y);

// Assert that the value of x is -210 / 1.
Assert.IsTrue(gmp_lib.mpq_cmp_si(x, -210, 1) == 0);

// Release unmanaged memory allocated for x and y.
gmp_lib.mpq_clear(x);
gmp_lib.mpz_clear(y);
See Also