gmp_lib.mpq_denref Method

GMP Native Interface for .NET

gmp_libmpq_denref Method
Return a reference to the denominator 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 mpz_t mpq_denref(
	mpq_t op
)
Public Shared Function mpq_denref ( 
	op As mpq_t
) As mpz_t
public:
static mpz_t^ mpq_denref(
	mpq_t^ op
)
static member mpq_denref : 
        op : mpq_t -> mpz_t 

Parameters

op
Type: Math.Gmp.Nativempq_t
The operand rational.

Return Value

Type: mpz_t
Return a reference to the denominator op.
Remarks

The mpz functions can be used on the returned reference.

Examples
// Create, initialize, and set the value of op to -1 / 3.
mpq_t op = new mpq_t();
gmp_lib.mpq_init(op);
gmp_lib.mpq_set_si(op, -1, 3U);

// Get reference to denominator, and increment it by 2.
mpz_t num = gmp_lib.mpq_denref(op);
gmp_lib.mpz_add_ui(num, num, 2U);

// Assert that op is -1 / 5.
Assert.IsTrue(gmp_lib.mpq_cmp_si(op, -1, 5U) == 0);

// Release unmanaged memory allocated for op.
gmp_lib.mpq_clear(op);
' Create, initialize, and set the value of op to -1 / 3.
Dim op As New mpq_t()
gmp_lib.mpq_init(op)
gmp_lib.mpq_set_si(op, -1, 3UI)

' Get reference to denominator, and increment it by 2.
Dim num As mpz_t = gmp_lib.mpq_denref(op)
gmp_lib.mpz_add_ui(num, num, 2UI)

' Assert that op is -1 / 5.
Assert.IsTrue(gmp_lib.mpq_cmp_si(op, -1, 5UI) = 0)

' Release unmanaged memory allocated for op.
gmp_lib.mpq_clear(op)

No code example is currently available or this language may not be supported.

No code example is currently available or this language may not be supported.

See Also